Skip to content

Instantly share code, notes, and snippets.

@soulfly
Created January 8, 2016 13:48
Show Gist options
  • Save soulfly/eea86e833d53f5aa7e3d to your computer and use it in GitHub Desktop.
Save soulfly/eea86e833d53f5aa7e3d to your computer and use it in GitHub Desktop.
python_gcm_sender
from gcm import GCM
API_KEY = "..."
gcm = GCM(API_KEY)
data = {'param1': 'value1', 'param2': 'value2'}
# JSON request
reg_ids = ['...']
response = gcm.json_request(registration_ids=reg_ids, data=data)
# Extra arguments
res = gcm.json_request(
registration_ids=reg_ids, data=data,
collapse_key='uptoyou', delay_while_idle=True, time_to_live=3600
)
print res
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment