mirror of
https://github.com/caronc/apprise.git
synced 2024-11-22 08:04:02 +01:00
Code Cleanup and Tidying (#793)
This commit is contained in:
parent
0b1655c5eb
commit
4ecfe7faf8
@ -117,9 +117,6 @@ class NotifyMailgun(NotifyBase):
|
||||
# Default Notify Format
|
||||
notify_format = NotifyFormat.HTML
|
||||
|
||||
# The default region to use if one isn't otherwise specified
|
||||
mailgun_default_region = MailgunRegion.US
|
||||
|
||||
# The maximum amount of emails that can reside within a single
|
||||
# batch transfer
|
||||
default_batch_size = 2000
|
||||
@ -250,7 +247,8 @@ class NotifyMailgun(NotifyBase):
|
||||
|
||||
# Store our region
|
||||
try:
|
||||
self.region_name = self.mailgun_default_region \
|
||||
self.region_name = \
|
||||
NotifyMailgun.template_args['region']['default'] \
|
||||
if region_name is None else region_name.lower()
|
||||
|
||||
if self.region_name not in MAILGUN_REGIONS:
|
||||
@ -667,7 +665,7 @@ class NotifyMailgun(NotifyBase):
|
||||
NotifyMailgun.unquote(results['qsd']['name'])
|
||||
|
||||
if 'region' in results['qsd'] and len(results['qsd']['region']):
|
||||
# Extract from name to associate with from address
|
||||
# Acquire region if defined
|
||||
results['region_name'] = \
|
||||
NotifyMailgun.unquote(results['qsd']['region'])
|
||||
|
||||
|
@ -583,6 +583,8 @@ class NotifySMSEagle(NotifyBase):
|
||||
['@{}'.format(x) for x in self.target_contacts],
|
||||
# Groups
|
||||
['#{}'.format(x) for x in self.target_groups],
|
||||
# Pass along the same invalid entries as were provided
|
||||
self.invalid_targets,
|
||||
)]),
|
||||
params=NotifySMSEagle.urlencode(params),
|
||||
)
|
||||
@ -633,6 +635,7 @@ class NotifySMSEagle(NotifyBase):
|
||||
results['status'] = \
|
||||
parse_bool(results['qsd'].get('status', False))
|
||||
|
||||
# Get priority
|
||||
if 'priority' in results['qsd'] and len(results['qsd']['priority']):
|
||||
results['priority'] = \
|
||||
NotifySMSEagle.unquote(results['qsd']['priority'])
|
||||
|
@ -79,8 +79,10 @@ SPARKPOST_HTTP_ERROR_MAP = {
|
||||
}
|
||||
|
||||
|
||||
# Priorities
|
||||
class SparkPostRegion:
|
||||
"""
|
||||
Regions
|
||||
"""
|
||||
US = 'us'
|
||||
EU = 'eu'
|
||||
|
||||
@ -141,9 +143,6 @@ class NotifySparkPost(NotifyBase):
|
||||
# Default Notify Format
|
||||
notify_format = NotifyFormat.HTML
|
||||
|
||||
# The default region to use if one isn't otherwise specified
|
||||
sparkpost_default_region = SparkPostRegion.US
|
||||
|
||||
# Define object templates
|
||||
templates = (
|
||||
'{schema}://{user}@{host}:{apikey}/',
|
||||
@ -254,7 +253,7 @@ class NotifySparkPost(NotifyBase):
|
||||
|
||||
# Store our region
|
||||
try:
|
||||
self.region_name = self.sparkpost_default_region \
|
||||
self.region_name = self.template_args['region']['default'] \
|
||||
if region_name is None else region_name.lower()
|
||||
|
||||
if self.region_name not in SPARKPOST_REGIONS:
|
||||
@ -746,7 +745,7 @@ class NotifySparkPost(NotifyBase):
|
||||
NotifySparkPost.unquote(results['qsd']['name'])
|
||||
|
||||
if 'region' in results['qsd'] and len(results['qsd']['region']):
|
||||
# Extract from name to associate with from address
|
||||
# Extract region
|
||||
results['region_name'] = \
|
||||
NotifySparkPost.unquote(results['qsd']['region'])
|
||||
|
||||
|
@ -192,7 +192,6 @@ def request_mock(mocker):
|
||||
|
||||
@pytest.fixture
|
||||
def simple_template(tmpdir):
|
||||
# Test cases where our URL is invalid.
|
||||
template = tmpdir.join("simple.json")
|
||||
template.write("""
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user