mirror of
https://github.com/caronc/apprise.git
synced 2024-11-22 08:04:02 +01:00
Add supplementary url support for pushover (#468)
This commit is contained in:
parent
e2ebdbdcf8
commit
e8add7b95a
@ -196,6 +196,14 @@ class NotifyPushover(NotifyBase):
|
||||
'regex': (r'^[a-z]{1,12}$', 'i'),
|
||||
'default': PushoverSound.PUSHOVER,
|
||||
},
|
||||
'url': {
|
||||
'name': _('URL'),
|
||||
'type': 'string',
|
||||
},
|
||||
'url_title': {
|
||||
'name': _('URL Title'),
|
||||
'type': 'string'
|
||||
},
|
||||
'retry': {
|
||||
'name': _('Retry'),
|
||||
'type': 'int',
|
||||
@ -215,7 +223,8 @@ class NotifyPushover(NotifyBase):
|
||||
})
|
||||
|
||||
def __init__(self, user_key, token, targets=None, priority=None,
|
||||
sound=None, retry=None, expire=None, **kwargs):
|
||||
sound=None, retry=None, expire=None, url=None,
|
||||
url_title=None, **kwargs):
|
||||
"""
|
||||
Initialize Pushover Object
|
||||
"""
|
||||
@ -241,6 +250,10 @@ class NotifyPushover(NotifyBase):
|
||||
if len(self.targets) == 0:
|
||||
self.targets = (PUSHOVER_SEND_TO_ALL, )
|
||||
|
||||
# Setup supplemental url
|
||||
self.supplemental_url = url
|
||||
self.supplemental_url_title = url_title
|
||||
|
||||
# Setup our sound
|
||||
self.sound = NotifyPushover.default_pushover_sound \
|
||||
if not isinstance(sound, six.string_types) else sound.lower()
|
||||
@ -319,6 +332,8 @@ class NotifyPushover(NotifyBase):
|
||||
'message': body,
|
||||
'device': device,
|
||||
'sound': self.sound,
|
||||
'url': self.supplemental_url,
|
||||
'url_title': self.supplemental_url_title
|
||||
}
|
||||
|
||||
if self.notify_format == NotifyFormat.HTML:
|
||||
@ -569,6 +584,12 @@ class NotifyPushover(NotifyBase):
|
||||
results['sound'] = \
|
||||
NotifyPushover.unquote(results['qsd']['sound'])
|
||||
|
||||
# Get the supplementary url
|
||||
if 'url' in results['qsd'] and len(results['qsd']['url']):
|
||||
results['url'] = NotifyPushover.unquote(results['qsd']['url'])
|
||||
if 'url_title' in results['qsd'] and len(results['qsd']['url_title']):
|
||||
results['url_title'] = results['qsd']['url_title']
|
||||
|
||||
# Get expire and retry
|
||||
if 'expire' in results['qsd'] and len(results['qsd']['expire']):
|
||||
results['expire'] = results['qsd']['expire']
|
||||
|
@ -3581,6 +3581,10 @@ TEST_URLS = (
|
||||
('pover://%s@%s?sound=spacealarm' % ('u' * 30, 'a' * 30), {
|
||||
'instance': plugins.NotifyPushover,
|
||||
}),
|
||||
# API Key + valid url_title with url
|
||||
('pover://%s@%s?url=my-url&url_title=title' % ('u' * 30, 'a' * 30), {
|
||||
'instance': plugins.NotifyPushover,
|
||||
}),
|
||||
# API Key + Valid User
|
||||
('pover://%s@%s' % ('u' * 30, 'a' * 30), {
|
||||
'instance': plugins.NotifyPushover,
|
||||
|
Loading…
Reference in New Issue
Block a user