Created
March 21, 2013 21:39
-
-
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
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
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