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