mirror of
https://github.com/caronc/apprise.git
synced 2025-06-24 19:51:21 +02:00
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 #121
This commit is contained in:
parent
43a2c7b17c
commit
35d2d358e7
@ -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.'
|
||||||
|
@ -787,10 +787,6 @@ TEST_URLS = (
|
|||||||
('mailgun://user@host', {
|
('mailgun://user@host', {
|
||||||
'instance': TypeError,
|
'instance': TypeError,
|
||||||
}),
|
}),
|
||||||
# Token specified but it's invalid
|
|
||||||
('mailgun://user@host/{}'.format('a' * 12), {
|
|
||||||
'instance': TypeError,
|
|
||||||
}),
|
|
||||||
# Token is valid, but no user name specified
|
# Token is valid, but no user name specified
|
||||||
('mailgun://host/{}-{}-{}'.format('a' * 32, 'b' * 8, 'c' * 8), {
|
('mailgun://host/{}-{}-{}'.format('a' * 32, 'b' * 8, 'c' * 8), {
|
||||||
'instance': TypeError,
|
'instance': TypeError,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user