PythonTip >> 博文 >> 开源软件

python-oauth2

zihua 2013-09-24 22:09:00 点击: 688 | 收藏


python-oauth2 是 Python 语言的 OAuth 2 的实现,包括客户端和服务器端。该项目经过完整的测试。

客户端示例代码:

import oauth2 as oauth

# Create your consumer with the proper key/secret.
consumer = oauth.Consumer(key="your-twitter-consumer-key", 
    secret="your-twitter-consumer-secret")

# Request token URL for Twitter.
request_token_url = "http://twitter.com/oauth/request_token"

# Create our client.
client = oauth.Client(consumer)

# The OAuth Client request works just like httplib2 for the most part.
resp, content = client.request(request_token_url, "GET")
print resp
print content
原文链接:http://www.oschina.net/p/python-oauth2

作者:zihua | 分类: 开源软件 | 标签: python开源 | 阅读: 688 | 发布于: 2013-09-24 22时 |