Skip to content

zhuowater/pyqqweibo

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pyqqweibo

腾讯微博 API Python 绑定, 基于 Twitter API 绑定库 tweepy 改写. 目前在不断完善中.

已经更新到 5.27 日 API 版本.

我就不吐槽腾讯的 API 了.

使用方法

相关例子请参考 examples 目录.

api.doc.rst 文件为参考文档.

# simple use
from qqweibo import OAuthHandler, API, JSONParser, ModelParser
from qqweibo.utils import timestamp_to_str

a = OAuthHandler('API_KEY', 'API_SECRET')

# use this
print a.get_authorization_url()
verifier = raw_input('PIN: ').strip()
a.get_access_token(verifier)

# or directly use:
#token = 'your token'
#tokenSecret = 'your secret'
#a.setToken(token, tokenSecret)

api = API(a)

me = api.user.info()
print me.name, me.nick, me.location

for t in me.timeline(reqnum=3):  # my timeline
	print t.nick, t.text, timestamp_to_str(t.timestamp)

nba = api.user.userinfo('NBA')
for u in nba.followers(reqnum=3):  # got NBA's fans
	u.follow()
	break  # follow only 1 fans ;)
u.unfollow()  # then unfollow

for t in nba.timeline(reqnum=1):
	print t.text
	t.favorite()  # i like this very much

for fav in api.fav.listtweet():
	if fav.id == t.id:
		fav.unfavorite()

已经完成功能

  • 5.27 API 版本
  • 授权
  • 所有 API json 请求返回
  • API model parser
  • 全部 API 名字修正, 比如替换 ht 为 topic

Further TODO

  • 翻页支持
  • Document
  • fix bugs
  • add more examples

About

本 API 绑定是在 tweepy https://github.com/joshthecoder/tweepy 的基础上完成.

作者: andelf andelf@gmail.com

License: MIT

环境依赖:

欢迎和我讨论相关问题 :)

About

腾讯微博 API 的python绑定

Resources

License

MIT, MIT licenses found

Licenses found

MIT
LICENSE
MIT
LICENSE.tweepy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published