Created
March 11, 2013 22:02
-
-
Save astraw/5138237 to your computer and use it in GitHub Desktop.
Simple pushover.net notifier
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
#!/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