Advertisement
Guest User

Untitled

a guest
Jun 1st, 2016
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PyCon 0.48 KB | None | 0 0
  1. data = serializers.serialize("json",[Concurso.objects.get(id=instance.id)])
  2.     for gcm in my_phone:
  3.         values = {
  4.                     "to": gcm.gcm_tok,
  5.                     "collapse_key": "collapse key" ,
  6.                     "data": data
  7.                   }
  8.  
  9.         headers = {
  10.                    "UserAgent":"GCMServer",
  11.                    "ContentType":"application/json",
  12.                    "Authorization":"key="+KEY
  13.                   }
  14.  
  15.         p = requests.post(url="https://android.googleapis.com/gcm/send",data=values,headers=headers)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement