Giter Club home page Giter Club logo

pusher_python_sdk's Introduction

Baidu Push 服务器端SDK Python版

吃水不忘挖井人,该sdk是在@luvchh基础上修改核心http请求方式来的,98%的代码是@luvchh完成的
第一版:
@luvchh 提供,并开放在github上:
github地址:https://github.com/Argger/pusher_python_sdk
第二版:
@搞基宫陈尸 修改,
github地址:https://github.com/blacklaw0/pusher_python_sdk


Python SDK总体介绍: 将百度Push服务端的所有操作封装成一个类Channel,通过对该类的简单初始化,即可调用其内部的各种方法,使用百度Push服务。 Channel提供的方法和服务端API对应,是对服务端REST API的封装,REST API请参考:http://developer.baidu.com/wiki/index.php?title=docs/cplat/push/api/list
使用前提: 支持pycurl的python版本

工具组成: Python SDK工具包主要由以下部分组成:

  • Channel.py -- Python_SDK 脚本,包含对外提供的所有接口
  • lib -- 使用到的一些基础公用文件
  • sample/sample.python -- 展示如何使用 Python_SDK 的 demo 文件

SDK 依赖于以下组件:

  • urllib,urllib2
  • python

一般规则

  • 所有函数的参数和返回值中如果有中文,必须是UTF-8编码;
  • 不需要对函数参数进行urlencode。 错误码集合 如果用户在调用SDK时发生错误,那么错误分成两大类:
  • 与服务交互失败产生的错误,比如:SDK参数不完整、网络错误、服务器的返回不是正确的json包导致无法解析等,这类错误的错误码位于1-100区间,具体如下: 服务器交互失败错误

错误码 错误信息

1 python sdk error
2 Python sdk init error
3 lack param
4 http status is error, and the body returned is not a json string
5 http status is ok, but the body returned is not a json string

与服务器交互成功,但服务器返回了非200的HTTP状态,比如用户权限错误、重复绑定等,具体如下:
HTTP状态错误 错误码 错误信息

30600 Internal Server Error
30601 Method Not Allowed
30602 Request Params Not Valid
30603 Authentication Failed
30604 Quota Use Up Payment Required
30605 Data Required Not Found
30606 Request Time Expires Timeout
30607 Channel Token Timeout
30608 Bind Relation Not Found
30609 Bind Number Too Many
30610 Duplicate Operation

pusher_python_sdk's People

Contributors

argger avatar hp027 avatar

Watchers

 avatar

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.