Skip to content

Instantly share code, notes, and snippets.

@shashankkr9
Created January 14, 2015 20:24
Show Gist options
  • Save shashankkr9/d88c6569524a63eef29b to your computer and use it in GitHub Desktop.
Save shashankkr9/d88c6569524a63eef29b to your computer and use it in GitHub Desktop.
Sending json parse push notification from webapp2 google app engine
import httplib
class PushParse(webapp2.RequestHandler):
def get(self):
connection = httplib.HTTPSConnection('api.parse.com', 443)
connection.connect()
connection.request('POST', '/1/push', json.dumps({
"channels": [
"News"
],
"data" : {
"alert": "Parse alert message",
"uri" : "http://www.parse.com",
"source" : "internal"
}
}), {
"X-Parse-Application-Id": "*************",
"X-Parse-REST-API-Key": "*****",
"Content-Type": "application/json"
})
result = json.loads(connection.getresponse().read())
self.write(result)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment