8000 GitHub - akaz00/python-gcm: Python client for Google Cloud Messaging for Android (GCM)
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Python client for Google Cloud Messaging for Android (GCM)

Notifications You must be signed in to change notification settings

akaz00/python-gcm

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

python-gcm

Build Status

Python client for Google Cloud Messaging for Android (GCM)

Usage

RTFM here

gcm = GCM(API_KEY)
data = {'param1': 'value1', 'param2': 'value2'}

# Plaintext request
reg_id = '12345'
res = gcm.plaintext_request(registration_id=reg_id, data=data)

# JSON request
reg_ids = ['12', '34', '69']
res = 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
)

# Handle responses. This raises exceptions when GCM servers return errors 
gcm.handle_response(res)

Exceptions

Read more on response errors here

  • GCMMalformedJsonException
  • GCMConnectionException
  • GCMAuthenticationException
  • GCMTooManyRegIdsException
  • GCMNoCollapseKeyException
  • GCMInvalidTtlException
  • GCMMissingRegistrationException
  • GCMMismatchSenderIdException
  • GCMNotRegisteredException
  • GCMMessageTooBigException

Gotta catch them all

About

Python client for Google Cloud Messaging for Android (GCM)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published
0