JPush API Python Client

Github Source Code


This is a Python version development package for the JPush REST API. It is provided by JPush officially and generally supports the latest API features. Corresponding REST API documentation:

Compatible Version

  • Python 2.7
  • Python 3

Environment Configuration

Pip Method::

sudo pip install jpush

Easy_install Method:

sudo easy_install jpush

Source Code Method:

sudo python install

Sample Code

Sample code is in the examples folder of jpush-api-python-client, click to view all examples.

The following fragment comes from the file in the project code: in the examples/push_examples directory of jpush-api-python-client

This sample demonstrates message push, log settings, and exception handling.

_jpush = jpush.JPush(app_key, master_secret)
push = _jpush.create_push()
# if you set the logging level to "DEBUG",it will show the debug logging.
push.audience = jpush.all_
push.notification = jpush.notification(alert="hello python jpush api")
push.platform = jpush.all_
except common.Unauthorized:
    raise common.Unauthorized("Unauthorized")
except common.APIConnectionException:
    raise common.APIConnectionException("conn error")
except common.JPushFailure:
    print ("JPushFailure")
    print ("Exception")

Log Description

The default logging level is WARNING , which is set to DEBUG in order to facilitate debugging. The setting method is:


Exception Description

  • Unauthorized
    • AppKey, Master Secret error. Must correct if the verification fails
  • APIConnectionException
    • Include incorrect information: timeouts, no network, etc.
  • JPushFailure
    • The request is wrong. Please refer to the business return code.

HTTP Status Code

Reference document:: Push v3 API Status Code Reference document:  Report API Status Code Reference Document: Device API Status Code Reference Document: Push Schedule API Status Code Reference Document: 

Release page has a detailed version for record releasing and downloading.

Copyright 2011-2018,, All Rights Reserved.
粤ICP备12056275号-13 深圳市和讯华谷信息技术有限公司

Documentation built with MkDocs.