GithubHelp home page GithubHelp logo

gonbo / weibo Goto Github PK

View Code? Open in Web Editor NEW

This project forked from lxyu/weibo

1.0 2.0 0.0 105 KB

Python sina weibo sdk. More simpler and cleaner than the official one.

Home Page: http://lxyu.github.com/weibo/

License: ISC License

Python 100.00%

weibo's Introduction

Weibo

新浪微博 python SDK.

使用 requests 进行相关网络操作,因而相对于官方的 sdk,极大的简化了代码,并提高了可读性。

包依赖

安装

推荐使用 pip 安装。

$ pip install weibo

使用说明

准备工作

  • 首先,注册一个新浪开发者帐号,并在 新浪开发平台 新建一个 app.
  • 创建好应用之后在 '应用信息 -> '基本信息' 里面获取 App KeyApp Secret.
  • 在 '应用信息 -> '高级信息' 里面设置好 '授权回调页'.

示例

下面分别用 API_KEY, API_SECRET, REDIRECT_URI 代表准备工作里面的三个参数。

>>> from weibo import Client
>>> c = Client(API_KEY, API_SECRET, REDIRECT_URI)
>>> c.authorize_url
'https://api.weibo.com/oauth2/authorize?redirect_uri=http%3A%2F%2F127.0.0.1%2Fcallback&client_id=123456'

复制链接到浏览器打开,获取 code.

>>> c.set_code('abcdefghijklmn')

至此 client 初始化完成。 参考 微博开发文档 进行接口调用。

>>> c.get('users/show', uid=1282440983)
>>> c.post('statuses/update', status='python sdk test, check out http://lxyu.github.com/weibo/')

weibo's People

Contributors

lxyu avatar gonbo avatar moon-clj avatar

Stargazers

 avatar

Watchers

James Cloos avatar  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.