Created
March 11, 2014 19:20
-
-
Save guilhermecarvalhocarneiro/9493057 to your computer and use it in GitHub Desktop.
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
def send_message(self): | |
json_data ={"collapse_key":"msg","data":{"data":"xyz",},"registration_ids":['APA91bH2DtFn9494z-*****bMP1BPUsVI8ltb395MNp-39k8sp0',],} | |
url ='https://android.googleapis.com/gcm/send' | |
myKey ="AIzaSyC********************A7S" | |
data = json.dumps(json_data) | |
headers ={'Content-Type':'application/json','Authorization':'key=%s'% myKey} | |
req = urllib2.Request(url, data, headers) | |
f = urllib2.urlopen(req) | |
response = json.loads(f.read()) | |
self.response.out.write(json.dumps(response,sort_keys=True, indent=2)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment