Skip to content

Instantly share code, notes, and snippets.

@guglielmino
Created January 24, 2015 15:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save guglielmino/60cfb8ef4cf47ec9a629 to your computer and use it in GitHub Desktop.
Save guglielmino/60cfb8ef4cf47ec9a629 to your computer and use it in GitHub Desktop.
Sample code for Pushetta
import urllib2
import json
def sendNotification(token, channel, message):
data = {
"body" : message,
"message_type" : "text/plain"
}
req = urllib2.Request('http://api.pushetta.com/api/pushes/{0}/'.format(channel))
req.add_header('Content-Type', 'application/json')
req.add_header('Authorization', 'Token {0}'.format(token))
response = urllib2.urlopen(req, json.dumps(data))
sendNotification("00112233445566778899aabbccddeeff00112233", "raspi", "Hello raspi from Python")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment