diff options
-rw-r--r-- | push.cfg | 5 | ||||
-rwxr-xr-x | push.py | 19 |
2 files changed, 13 insertions, 11 deletions
@@ -7,7 +7,8 @@ senders: recipients: - re: 'recipient1\@example\.com' keys: - - 'user token 1' + - 'user token 1': 'my device' - 'user token 2' - re: 'recipient2\@example\.com' - keys: 'user token' + keys: + - 'user token' @@ -113,13 +113,14 @@ except (NameError, TypeError): msg = payload.strip() -# Check for multiple user keys -if type(user_tokens) is list: - # Send notification to each user key - for user_token in user_tokens: - p = pushover.Client(user_token, api_token=api_token) - p.send_message(msg, title=title) -else: - # Send notification to the only user key - p = pushover.Client(user_tokens, api_token=api_token) +# Send notification to each user key +for user_token in user_tokens: + if type(user_token) is dict: + k = user_token.keys()[0] + device = user_token.get(k, None) + user_token = k + else: + device = None + + p = pushover.Client(user_token, api_token=api_token, device=device) p.send_message(msg, title=title) |