Created
August 14, 2014 05:32
-
-
Save matbor/6854893169c3e2978425 to your computer and use it in GitHub Desktop.
pushalot.com python test , replace xxxxxxxxxxxxxxx with your Authorization token(api). Modified from sickbeards pushalot notifier.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
from urllib import urlencode | |
from httplib import HTTPSConnection, HTTPException | |
from ssl import SSLError | |
pushalot_authorizationtoken = 'xxxxxxxxxxxxxxx' | |
pushalot_title = 'title' | |
pushalot_body = 'body' | |
http_handler = HTTPSConnection("pushalot.com") | |
data = {'AuthorizationToken': pushalot_authorizationtoken, | |
'Title': pushalot_title.encode('utf-8'), | |
'Body': pushalot_body.encode('utf-8') } | |
try: | |
http_handler.request("POST", | |
"/api/sendmessage", | |
headers = {'Content-type': "application/x-www-form-urlencoded"}, | |
body = urlencode(data)) | |
except (SSLError, HTTPException): | |
print("Pushalot notification failed.") | |
response = http_handler.getresponse() | |
print(response.status, response.reason) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment