Created
January 14, 2015 20:24
-
-
Save shashankkr9/d88c6569524a63eef29b to your computer and use it in GitHub Desktop.
Sending json parse push notification from webapp2 google app engine
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 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