https://github.com/upbit/tweibo-pysdk
腾讯微博Python SDK (Tencent Weibo SDK for Python)
https://github.com/upbit/tweibo-pysdk
Last synced: about 1 year ago
JSON representation
腾讯微博Python SDK (Tencent Weibo SDK for Python)
- Host: GitHub
- URL: https://github.com/upbit/tweibo-pysdk
- Owner: upbit
- Created: 2013-06-23T14:32:15.000Z (almost 13 years ago)
- Default Branch: master
- Last Pushed: 2014-08-12T11:03:51.000Z (almost 12 years ago)
- Last Synced: 2025-02-21T23:43:23.842Z (over 1 year ago)
- Language: Python
- Homepage:
- Size: 1.11 MB
- Stars: 12
- Watchers: 5
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# 腾讯微博SDK for Python
参考 @michaelliao 的 [sinaweibopy](https://github.com/michaelliao/sinaweibopy) 写了个腾讯的API。采用相同的动态 [_http_call()](https://github.com/upbit/tweibo-pysdk/blob/master/tweibo/tweibo.py#L102) 调用方式,具有代码量少易于维护等特点。
API的详细使用方法见[demo.py](https://github.com/upbit/tweibo-pysdk/blob/master/demo.py),已测试版本:Python 2.7
## FAQ
1. [OAuth2Handler(): OAuth2鉴权说明](https://github.com/upbit/tweibo-pysdk/wiki/OAuth2Handler)
2. [demo.py详解](https://github.com/upbit/tweibo-pysdk/wiki/demo.py%E8%AF%A6%E8%A7%A3)
***
demo.py演示: 上传example.png并发表微博
```python
# UPLOAD /t/upload_pic
pic1 = api.upload.t__upload_pic(format="json", pic_type=2, pic=open(IMG_EXAMPLE, "rb"))
print ">> IMG: %s" % (pic1.data.imgurl)
# POST /t/add_pic_url
content_str2 = "[from PySDK] add pic demo: %s, time %s" % (IMG_EXAMPLE, time.time())
pic_urls = "%s" % (pic1.data.imgurl)
tweet_pic1 = api.post.t__add_pic_url(format="json", content=content_str2, pic_url=pic_urls, clientip="10.0.0.1")
print ">> time=%s, http://t.qq.com/p/t/%s" % (tweet_pic1.data.time, tweet_pic1.data.id)
```
