Skip to content

Instantly share code, notes, and snippets.

@dbapl
Forked from astraw/beep.py
Created April 23, 2017 16:04
Show Gist options
  • Save dbapl/b5efaf2d10eb090297df0df88eafd9d8 to your computer and use it in GitHub Desktop.
Save dbapl/b5efaf2d10eb090297df0df88eafd9d8 to your computer and use it in GitHub Desktop.
Simple pushover.net notifier
#!/usr/bin/env python
import httplib, urllib
import argparse
def main():
parser = argparse.ArgumentParser(
description='send pushover.net notification')
parser.add_argument('note', metavar='note', default=['(no note)'], nargs='*')
args = parser.parse_args()
note = ' '.join(args.note)
#print 'repr(args.note): ',repr(args.note)
print 'Sending: %s'%note
conn = httplib.HTTPSConnection("api.pushover.net:443")
conn.request("POST", "/1/messages",
urllib.urlencode({
"token": "<APP TOKEN>",
"user": "<USER KEY>",
"message": note,
}), { "Content-type": "application/x-www-form-urlencoded" })
if __name__=='__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment