Skip to content

Instantly share code, notes, and snippets.

@nolageek
Last active February 4, 2016 07:12
Show Gist options
  • Save nolageek/0fdc7aa5eccb270c413b to your computer and use it in GitHub Desktop.
Save nolageek/0fdc7aa5eccb270c413b to your computer and use it in GitHub Desktop.
Pushover Notifications for x/84
import httplib, urllib
# Config
# You will need to sign up for a pushover.net account - and download
# their paid ios or android apps or their various 3rd party plugins.
# https://pushover.net/apps
appToken = "APPTOKEN HERE"
userKey = "USERKEY HERE"
# 1) save this file as /path-to/site-packages/x84/default/pushover.py or wherever
# is appropriate for your configuration.
# 2) open top.py and add this after the other from/import lines:
#
# = # 3rd
# = from sauce import SAUCE
# =
# + # notification
# + from pushover import push
#
# then find a good spot to send the notification
# I put mine after Line 300:
# = login(session, get_user_record(handle))
# =
# + push("%s has logged in!" % handle.upper());
def push(msg):
conn = httplib.HTTPSConnection("api.pushover.net:443")
conn.request("POST", "/1/messages.json",
urllib.urlencode({
"token": appToken,
"user": userKey,
"message": msg,
}), { "Content-type": "application/x-www-form-urlencoded" })
conn.getresponse()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment