JPush's officially supported Python client library for accessing JPush APIs.
JPush Rest API Documents: http://docs.jpush.cn/display/dev/REST+API
You can download the latest release file here: Releases
To install jpush-api-python-client, simply:
$ sudo pip install jpush
or alternatively install via easy_install:
$ sudo easy_install jpush
or from source:
$ sudo python setup.py install
For running the tests, you need the standard unittest module, shipped with Python.
To run jpush-api-python-client tests, simply:
$ nosetests tests/push tests/devices --verbosity=2
You can see more examples in examples
>>> import jpush as jpush >>> from conf import app_key, master_secret >>> _jpush = jpush.JPush(app_key, master_secret) >>> push = _jpush.create_push() >>> push.audience = jpush.all_ >>> ios_msg = jpush.ios(alert="Hello, IOS JPush!", badge="+1", sound="a.caf", extras={'k1':'v1'}) >>> push.notification = jpush.notification(alert="Hello, JPush!", android=android_msg, ios=ios_msg) >>> push.options = {"time_to_live":86400, "sendno":12345,"apns_production":True} >>> push.platform = jpush.platform("ios") >>> push.send()
>>> import jpush as jpush >>> from conf import app_key, master_secret >>> _jpush = jpush.JPush(app_key, master_secret) >>> device = _jpush.create_device() >>> device.get_taglist()
The best place to ask questions is our Q&A site: http://www.jpush.cn/qa/
crystal-wei for reporting the jpush-api-python-client issues;