Bitbucket is a code hosting site with unlimited public and private repositories. We're also free for small teams!

Close

Python Client for GAE Channel API

A python client implementation for Google Appengine Channel API.

Google only provides a javascript client, while I needed long polls using a python client. So I reverse engineered the protocol and implemented it in python.

It seems to work, though it's not well tested yet. Be aware that google could change the underlying protocol without any notice. The best thing you can expect in such a case is to get ChannelError exception. But it could also just stop workin in some other way. You've been warned.

Usage

import gae_channel

channel = gae_channel.Client(token='your channel token')
for msg in chan.messages():
    print msg

Demo

Also have a look at /demo. There's a small demo client.

$ python receiver.py 
Your channel name is: fWVwdXvNJP
now run in an other terminal:
python sender.py fWVwdXvNJP
I'm now listening for messages, dont close this terminal...

Now in another terminal, run:

$ python sender.py fWVwdXvNJP
Enter a message:test

Now you'll see the message in the first terminal:

Message received: test

Recent activity

Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.