Skip to content

Commit

Permalink
token= and push_key= support added
Browse files Browse the repository at this point in the history
  • Loading branch information
caronc committed Aug 19, 2023
1 parent 4e1eee9 commit b630b7a
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
18 changes: 18 additions & 0 deletions apprise/plugins/NotifyPushMe.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,16 @@ class NotifyPushMe(NotifyBase):
},
})

# Define our template arguments
template_args = dict(NotifyBase.template_args, **{
'token': {
'alias_of': 'token',
},
'push_key': {
'alias_of': 'token',
},
})

def __init__(self, token, **kwargs):
"""
Initialize PushMe Object
Expand Down Expand Up @@ -185,4 +195,12 @@ def parse_url(url):
# Store our token using the host
results['token'] = NotifyPushMe.unquote(results['host'])

# The 'token' makes it easier to use yaml configuration
if 'token' in results['qsd'] and len(results['qsd']['token']):
results['token'] = NotifyPushMe.unquote(results['qsd']['token'])

elif 'push_key' in results['qsd'] and len(results['qsd']['push_key']):
# Support 'push_key' if specified
results['token'] = NotifyPushMe.unquote(results['qsd']['push_key'])

return results
14 changes: 14 additions & 0 deletions test/test_plugin_pushme.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,20 @@
# Our expected url(privacy=True) startswith() response:
'privacy_url': 'pushme://a...a/',
}),
# Token specified
('pushme://?token=%s' % ('b' * 6), {
'instance': NotifyPushMe,

# Our expected url(privacy=True) startswith() response:
'privacy_url': 'pushme://b...b/',
}),
# Token specified
('pushme://?push_key=%s' % ('p' * 6), {
'instance': NotifyPushMe,

# Our expected url(privacy=True) startswith() response:
'privacy_url': 'pushme://p...p/',
}),
('pushme://%s' % ('c' * 6), {
'instance': NotifyPushMe,
# force a failure
Expand Down

0 comments on commit b630b7a

Please sign in to comment.