24 lines
581 B
Python
Executable File
24 lines
581 B
Python
Executable File
#!/usr/bin/python
|
|
|
|
import sys
|
|
import http.client, urllib.request, urllib.parse, urllib.error
|
|
|
|
def pushover(msg):
|
|
conn = http.client.HTTPSConnection("api.pushover.net:443")
|
|
conn.request("POST", "/1/messages.json",
|
|
urllib.parse.urlencode({
|
|
"token": "ac7NLX2rPjXFareeDgLpXNoDf4iFmf",
|
|
"user": "uDhH33UjQQDYtNzJb1ThRiWb9ingGK",
|
|
"message": msg,
|
|
}), { "Content-type": "application/x-www-form-urlencoded" })
|
|
r1=conn.getresponse()
|
|
#print r1.status, r1.reason
|
|
return r1.status == 200
|
|
|
|
|
|
v=" ".join(sys.argv[1:])
|
|
if pushover(v):
|
|
print("delivered")
|
|
else:
|
|
print("NOT delivered")
|