Giter Club home page Giter Club logo

gae-python-gcm's Introduction

About

gae-python-gcm is a simple implementation of Google Cloud Messaging for Google App Engine in Python.

This module is designed to take care of everything you have to think about when working with Android GCM messages on the server:

  • Takes advantage of App Engine's task queues to make retries asyncronous
  • Uses App Engine's memcache to collect error statistics
  • Provides two hook functions, delete_bad_token and update_token, which can be overridden or configured from a settings files to implement these actions in your environent.
  • Example django settings and testing / debug handlers.

Implementation with / without django

gae-python-gcm can be used with or without Django. The provided example was taken from a django-nonrel enviroment and is based on the way we use it at Pulse. If you want to use it with App Engine's built-in Django or without Django at all, it should be relatively simple to take the core functionality in /gae-python-gcm/gcm.py and leave the rest. Feel free to contact me if you have any quesitons (@gregbayer).

Why not use Google's GCM Server referance implmentation

We prefer to keep everything in Python instead of using the GCM server referance implmentation in Java.

Example

from gae_python_gcm.gcm import GCMMessage, GCMConnection

gcm_message = GCMMessage(push_token, android_payload)
gcm_conn = GCMConnection()
gcm_conn.notify_device(gcm_message)

Getting started

To add gae-python-gcm to your AppEngine project without Django:

  1. git clone git://github.com/gregbayer/gae-python-gcm.git
  2. Add entries to your app.yaml and queue.yaml based on included files.
  3. Copy the gae-python-gcm directory into your appengine project
  4. Make sure you set YOUR-GCM-API-KEY in /gae_python_gcm/gcm.py or in the settings module.

To add gae-python-gcm to your AppEngine project with Django:

  1. git clone git://github.com/gregbayer/gae-python-gcm.git
  2. Add entries to your app.yaml and queue.yaml based on included files.
  3. Copy the gae-python-gcm directory into your appengine project
  4. Configure your project as appropriate. You may find the urls.py and settings.py examples in the example_django_files directories useful.
  5. Make sure you set YOUR-GCM-API-KEY in /gae_python_gcm/gcm.py or in the settings module.

gae-python-gcm's People

Contributors

gregbayer avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

gae-python-gcm's Issues

django cache and settings error

Any reason gcm.py opts for django's cache module instead of using GAE's memcache one?

I don't use django and had to edit gcm.py to replace cache with memcache.

Thanks for this by the way!

Possible elif lapse

Hi,

I've found the following line which may contain a small error.

In the current HEAD version, gcp.py, line 291, I can see this sequence:

if 400

if 401

elif 500

elif 503

else

I believe the second one should read elif 401 otherwise 400 errors will be handled twice. The only real effect is logging it twice under slightly different messages though...

404 accessing /gae_python_gcm/send_request

This script is generating a 404 bad request when trying to access /gae_python_gcm/send_request. I'm not using django. What do I have to change to route that request appropriately?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.