@ -51,7 +51,6 @@
# the email will be transmitted from. If no email address is specified
# the email will be transmitted from. If no email address is specified
# then it will also become the 'to' address as well.
# then it will also become the 'to' address as well.
#
#
import re
import requests
import requests
from . NotifyBase import NotifyBase
from . NotifyBase import NotifyBase
@ -60,9 +59,6 @@ from ..utils import parse_list
from . . utils import is_email
from . . utils import is_email
from . . AppriseLocale import gettext_lazy as _
from . . AppriseLocale import gettext_lazy as _
# Used to validate your personal access apikey
VALIDATE_API_KEY = re . compile ( r ' ^[a-z0-9] {32} -[a-z0-9] {8} -[a-z0-9] {8} $ ' , re . I )
# Provide some known codes Mailgun uses and what they translate to:
# Provide some known codes Mailgun uses and what they translate to:
# Based on https://documentation.mailgun.com/en/latest/api-intro.html#errors
# Based on https://documentation.mailgun.com/en/latest/api-intro.html#errors
MAILGUN_HTTP_ERROR_MAP = {
MAILGUN_HTTP_ERROR_MAP = {
@ -138,7 +134,6 @@ class NotifyMailgun(NotifyBase):
' apikey ' : {
' apikey ' : {
' name ' : _ ( ' API Key ' ) ,
' name ' : _ ( ' API Key ' ) ,
' type ' : ' string ' ,
' type ' : ' string ' ,
' regex ' : ( r ' [a-z0-9] {32} -[a-z0-9] {8} -[a-z0-9] {8} ' , ' i ' ) ,
' private ' : True ,
' private ' : True ,
' required ' : True ,
' required ' : True ,
} ,
} ,
@ -184,12 +179,6 @@ class NotifyMailgun(NotifyBase):
self . logger . warning ( msg )
self . logger . warning ( msg )
raise TypeError ( msg )
raise TypeError ( msg )
if not VALIDATE_API_KEY . match ( self . apikey ) :
msg = ' The API Key specified ( {} ) is invalid. ' \
. format ( apikey )
self . logger . warning ( msg )
raise TypeError ( msg )
# Validate our username
# Validate our username
if not self . user :
if not self . user :
msg = ' No username was specified. '
msg = ' No username was specified. '