Advertisement
htnawsaj

Pushover

Feb 11th, 2014
464
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.71 KB | None | 0 0
  1.  
  2.  
  3. #!/usr/bin/env python
  4.  
  5. import httplib, urllib
  6. import sys
  7.  
  8.  
  9. def sendmessage():
  10.     conn = httplib.HTTPSConnection("api.pushover.net:443")
  11.     conn.request("POST", "/1/messages.json",
  12.       urllib.urlencode({
  13.         "token": "Your App Api goes here",
  14.         "user": "Your User Key goes here",
  15.         "message": str(sys.argv[1]),
  16.         "title": str(sys.argv[2]),
  17.         "url": str(sys.argv[3])
  18.       }), { "Content-type": "application/x-www-form-urlencoded" })
  19.     conn.getresponse()
  20.     print "Message has been Sent"
  21.  
  22.  
  23.  
  24. def main():
  25.     if len(sys.argv) != 4:
  26.         print("Usage: PushOver.py 'message' 'title' 'url' \n")
  27.     else:
  28.         sendmessage()
  29.  
  30. if __name__ == '__main__':
  31.     main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement