Python Push is a Python server-side library for sending Push Notifications to multiple mobile platforms.
This library is still in its very early stages, for now it is only supported Ping Pushes, which means that no data is sent in the push, but the Demo Application shows a way to handle this using post syncronization wich is even better than send the info in the push.
Again this library is not yet ready for production projects.
- Android GCM
- Blackberry Push Protocol.
- iOS APN
- Windows Phone 7
- Symbian
- Browsers (With sockets)
- Windows 8
For a full project with mobile apps see the Demo Application.
You'll have to run "python setup.py install" or install Python AsyncHTTP and its dependences.
Sending a ping Push:
from python_push.push_manager import PushManager
from python_push.gcm.gcm_push_service import GCMPushService
from python_push.blackberry.bb_push_service import BBPushService
from python_push.message import Message
from python_push.device import Device
push_manager = PushManager([
GCMPushService({'api_id': 'GCM API KEY'}),
BBPushService({'api_id': 'BLACKBERRY APP ID', 'password': 'BLACKBERRY APP PASSWORD'})
])
msg = Message()
device_list = [
Device(BBPushService.type, 'BLACKBERRY DEVICE PIN'),
Device(GCMPushService.type, 'GCM DEVICE TOKEN')
]
status_dict = push_manager.send(msg, device_list)
for type, status in status_dict.iteritems():
print 'Service %s: Status %i, Content %s\n' % (type, status.code, status.raw)
Changed from GRequests to Python AsyncHTTP
GRequests is to hard to install on Mac, Windows and some Linux distros and has too many dependences, for that reason python-push now is using "python-asynchttp" to send asynchronous HTTP and HTTPS requests.
The demo proyect is ready and has its own repo: https://github.com/maxrevilo/python-push-demo
It features a Django Server using Python Push and four navite apps, two of Android and Two of Blackberry.
Now we support "ping" pushes to Android GCMs and Blackberries devices.
A "ping" push is a push which carries no content, for GCM this means use collapse_key.
These features are under development and not widely tested.
Theoretically is possible to send push with content.