Created
January 24, 2015 15:39
-
-
Save guglielmino/60cfb8ef4cf47ec9a629 to your computer and use it in GitHub Desktop.
Sample code for Pushetta
This file contains 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
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