Skip to content

Instantly share code, notes, and snippets.

@fcrespo82
Created March 21, 2013 21:39
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fcrespo82/5217065 to your computer and use it in GitHub Desktop.
Save fcrespo82/5217065 to your computer and use it in GitHub Desktop.
This gist describes how to send messages via push to your phone using pushover API
import requests
USER_TOKEN = u'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX' #replace with your user key
APP_TOKEN = u'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX' #replace with your APP token/key
HEADERS = { "Content-type": "application/x-www-form-urlencoded" }
def sendPush(message, title, url, url_title):
parameters = { u'token': APP_TOKEN,
u'user': USER_TOKEN,
u'message': message,
u'title': title,
u'url': url,
u'url_title': url_title }
r = requests.post(u'https://api.pushover.net/1/messages.json', data=parameters, headers=HEADERS)
print(r.headers)
if r.status_code == requests.codes.ok:
print(u'Push sent successfully')
else:
print(u'Error sending push')
sendPush('How to open Launch Center Pro from pushover', 'Pushover test', 'launchpro://', 'Open Launch Center Pro')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment