mirror of https://github.com/caronc/apprise
Mailgun API key validation removed (#122)
* don't validate the format of the Mailgun API key * remove test validating Mailgun API key * remove rather than comment * remove no-longer-relevant regex for Mailgun API key validation refs #121pull/125/head
parent
43a2c7b17c
commit
35d2d358e7
|
@ -51,7 +51,6 @@
|
|||
# the email will be transmitted from. If no email address is specified
|
||||
# then it will also become the 'to' address as well.
|
||||
#
|
||||
import re
|
||||
import requests
|
||||
|
||||
from .NotifyBase import NotifyBase
|
||||
|
@ -60,9 +59,6 @@ from ..utils import parse_list
|
|||
from ..utils import is_email
|
||||
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:
|
||||
# Based on https://documentation.mailgun.com/en/latest/api-intro.html#errors
|
||||
MAILGUN_HTTP_ERROR_MAP = {
|
||||
|
@ -138,7 +134,6 @@ class NotifyMailgun(NotifyBase):
|
|||
'apikey': {
|
||||
'name': _('API Key'),
|
||||
'type': 'string',
|
||||
'regex': (r'[a-z0-9]{32}-[a-z0-9]{8}-[a-z0-9]{8}', 'i'),
|
||||
'private': True,
|
||||
'required': True,
|
||||
},
|
||||
|
@ -184,12 +179,6 @@ class NotifyMailgun(NotifyBase):
|
|||
self.logger.warning(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
|
||||
if not self.user:
|
||||
msg = 'No username was specified.'
|
||||
|
|
|
@ -787,10 +787,6 @@ TEST_URLS = (
|
|||
('mailgun://user@host', {
|
||||
'instance': TypeError,
|
||||
}),
|
||||
# Token specified but it's invalid
|
||||
('mailgun://user@host/{}'.format('a' * 12), {
|
||||
'instance': TypeError,
|
||||
}),
|
||||
# Token is valid, but no user name specified
|
||||
('mailgun://host/{}-{}-{}'.format('a' * 32, 'b' * 8, 'c' * 8), {
|
||||
'instance': TypeError,
|
||||
|
|
Loading…
Reference in New Issue