Merge pull request #33 from mitchellklijs/develop

Add priorty to pushover notifications
pull/54/head
desimaniac 7 years ago
commit 01372ade5d

@ -259,7 +259,8 @@ You can repeat this process for as many users as you like.
"pushover": {
"service": "pushover",
"app_token": "",
"user_token": ""
"user_token": "",
"priority": 0
},
"slack": {
"service": "slack",
@ -564,7 +565,8 @@ Currently, only Pushover and Slack are supported. More will be added later.
"pushover": {
"service": "pushover",
"app_token": "",
"user_token": ""
"user_token": "",
"priority": 0
},
"slack": {
"service": "slack",
@ -582,6 +584,8 @@ Currently, only Pushover and Slack are supported. More will be added later.
`app_token` and `user_token` - retrieve from Pushover.net.
You can specify a priority for the messages send via Pushover using the `priority` key. It can be any Pushover priority value (https://pushover.net/api#priority).
_Note: The key name (i.e the name right under notifications) can be anything, but the `"service":` must be exactly `"pushover"`._

@ -8,9 +8,10 @@ log = logger.get_logger(__name__)
class Pushover:
NAME = "Pushover"
def __init__(self, app_token, user_token):
def __init__(self, app_token, user_token, priority=0):
self.app_token = app_token
self.user_token = user_token
self.priority = priority
log.debug("Initialized Pushover notification agent")
def send(self, **kwargs):
@ -23,7 +24,8 @@ class Pushover:
payload = {
'token': self.app_token,
'user': self.user_token,
'message': kwargs['message']
'message': kwargs['message'],
'priority': self.priority,
}
resp = requests.post('https://api.pushover.net/1/messages.json', data=payload, timeout=30)
return True if resp.status_code == 200 else False

Loading…
Cancel
Save