#!/usr/bin/python import httplib, urllib from urllib import urlopen my_ip=urlopen('http://ip.42.pl/raw').read() conn = httplib.HTTPSConnection("api.pushover.net:443") conn.request("POST", "/1/messages.json", urllib.urlencode({ "token": "token", # Insert app token here "user": "user", # Insert user token here "html": "1", # 1 for HTML, 0 to disable "title":"My raspberry pi IP: " + my_ip, # Title of the message "message": "Server and downstairs camera power <b>on</b>!", # Content of the message - include$ "url": my_ip, # Link to be included in message "url_title": "My Raspberry", # Text for the link "sound": "spacealarm", # Define the sound played on the r$ }), { "Content-type": "application/x-www-form-urlencoded" }) conn.getresponse()
Run
Reset
Share
Import
Link
Embed
Language▼
English
中文
Python Fiddle
Python Cloud IDE
Follow @python_fiddle
Browser Version Not Supported
Due to Python Fiddle's reliance on advanced JavaScript techniques, older browsers might have problems running it correctly. Please download the latest version of your favourite browser.
Chrome 10+
Firefox 4+
Safari 5+
IE 10+
Let me try anyway!
url:
Go
Python Snippet
Stackoverflow Question