Skip to content

uniite/python-gcm

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 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
  • GCMMissingRegistrationException
  • GCMMismatchSenderIdException
  • GCMNotRegisteredException
  • GCMMessageTooBigException

About

Python client for Google Cloud Messaging for Android (GCM)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Python 100.0%