Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.