-
Notifications
You must be signed in to change notification settings - Fork 0
/
pushover.py
executable file
·33 lines (26 loc) · 1.05 KB
/
pushover.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import http.client, urllib.request, urllib.parse, urllib.error
import config
def send_message(message,url=None,priority=0):
conn = http.client.HTTPSConnection("api.pushover.net:443")
conn.request("POST", "/1/messages.json",
urllib.parse.urlencode({
"token": config.pushover["token"],
"user": config.pushover["user"],
"message": message,
"url": url,
"priority": priority,
}), { "Content-type": "application/x-www-form-urlencoded" })
conn.getresponse()
def send_message_alert(message,url=None,priority=0):
conn = http.client.HTTPSConnection("api.pushover.net:443")
conn.request("POST", "/1/messages.json",
urllib.parse.urlencode({
"token": config.pushover["token"],
"user": config.pushover["user"],
"message": message,
"url": url,
"priority": priority,
}), { "Content-type": "application/x-www-form-urlencoded" })
conn.getresponse()
if __name__ == "__main__":
send_message("Test con coma y prioridad 0",priority=0)