Skip to content

Instantly share code, notes, and snippets.

@matbor
Created August 14, 2014 05:32
Show Gist options
  • Save matbor/6854893169c3e2978425 to your computer and use it in GitHub Desktop.
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.
#!/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