mirror of
https://github.com/caronc/apprise.git
synced 2025-06-29 06:02:02 +02:00
Add option label for plugin seven (#1304)
This commit is contained in:
parent
3cc98662f3
commit
386c77e14d
@ -113,10 +113,14 @@ class NotifySeven(NotifyBase):
|
|||||||
'type': 'bool',
|
'type': 'bool',
|
||||||
'default': False,
|
'default': False,
|
||||||
},
|
},
|
||||||
|
'label': {
|
||||||
|
'name': _('Label'),
|
||||||
|
'type': 'string'
|
||||||
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
def __init__(self, apikey, targets=None, source=None, flash=None,
|
def __init__(self, apikey, targets=None, source=None, flash=None,
|
||||||
**kwargs):
|
label=None, **kwargs):
|
||||||
"""
|
"""
|
||||||
Initialize Seven Object
|
Initialize Seven Object
|
||||||
"""
|
"""
|
||||||
@ -133,6 +137,8 @@ class NotifySeven(NotifyBase):
|
|||||||
if not isinstance(source, str) else source.strip()
|
if not isinstance(source, str) else source.strip()
|
||||||
self.flash = self.template_args['flash']['default'] \
|
self.flash = self.template_args['flash']['default'] \
|
||||||
if flash is None else bool(flash)
|
if flash is None else bool(flash)
|
||||||
|
self.label = None \
|
||||||
|
if not isinstance(label, str) else label.strip()
|
||||||
|
|
||||||
# Parse our targets
|
# Parse our targets
|
||||||
self.targets = list()
|
self.targets = list()
|
||||||
@ -154,7 +160,7 @@ class NotifySeven(NotifyBase):
|
|||||||
def url_identifier(self):
|
def url_identifier(self):
|
||||||
"""
|
"""
|
||||||
Returns all of the identifiers that make this URL unique from
|
Returns all of the identifiers that make this URL unique from
|
||||||
another simliar one. Targets or end points should never be identified
|
another similar one. Targets or end points should never be identified
|
||||||
here.
|
here.
|
||||||
"""
|
"""
|
||||||
return (self.secure_protocol, self.apikey)
|
return (self.secure_protocol, self.apikey)
|
||||||
@ -189,6 +195,8 @@ class NotifySeven(NotifyBase):
|
|||||||
payload['from'] = self.source
|
payload['from'] = self.source
|
||||||
if self.flash:
|
if self.flash:
|
||||||
payload['flash'] = self.flash
|
payload['flash'] = self.flash
|
||||||
|
if self.label:
|
||||||
|
payload['label'] = self.label
|
||||||
# Create a copy of the targets list
|
# Create a copy of the targets list
|
||||||
targets = list(self.targets)
|
targets = list(self.targets)
|
||||||
while len(targets):
|
while len(targets):
|
||||||
@ -278,6 +286,8 @@ class NotifySeven(NotifyBase):
|
|||||||
}
|
}
|
||||||
if self.source:
|
if self.source:
|
||||||
params['from'] = self.source
|
params['from'] = self.source
|
||||||
|
if self.label:
|
||||||
|
params['label'] = self.label
|
||||||
|
|
||||||
# Our URL parameters
|
# Our URL parameters
|
||||||
params = self.url_parameters(privacy=privacy, *args, **kwargs)
|
params = self.url_parameters(privacy=privacy, *args, **kwargs)
|
||||||
@ -332,5 +342,7 @@ class NotifySeven(NotifyBase):
|
|||||||
|
|
||||||
results['flash'] = \
|
results['flash'] = \
|
||||||
parse_bool(results['qsd'].get('flash', False))
|
parse_bool(results['qsd'].get('flash', False))
|
||||||
|
results['label'] = \
|
||||||
|
results['qsd'].get('label', None)
|
||||||
|
|
||||||
return results
|
return results
|
||||||
|
@ -93,6 +93,10 @@ apprise_url_tests = (
|
|||||||
# valid number, utilizing the optional source= variable (same as from)
|
# valid number, utilizing the optional source= variable (same as from)
|
||||||
'instance': NotifySeven,
|
'instance': NotifySeven,
|
||||||
}),
|
}),
|
||||||
|
('seven://{}/15551232000?source=AR&flash=1&label=123'.format('3' * 14), {
|
||||||
|
# valid number, utilizing the optional source= variable (same as from)
|
||||||
|
'instance': NotifySeven,
|
||||||
|
}),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user