我已经成功安装了 Tweepy。我已经成功安装了 SocialRegistration (Twitter oauth)。但现在我正在尝试在 Tweepy 中做一些需要身份验证的事情,但它无法正常工作。我不断收到“需要身份验证”错误页面。我如何“连接”SocialRegistration 与 Tweepy?我需要将 token 传递给 tweepy 吗?请问有谁用过这两个模块吗?提前致谢。
请您参考如下方法:
不太清楚您要通过这两个模块(社会注册和 tweepy)实现什么
我假设您正在尝试使用 tweepy API 来做一些需要身份验证的事情(例如状态更新),所以这里是如何在 tweepy 中进行简单的 oauth 身份验证。
#Requirements:
#tweepy
#consumer_key
#consumer_secret
#access_token_key
#access_token_secret
import tweepy
#build auth handler
auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
auth.set_access_token(access_token_key, access_token_secret)
# initialize tweepy API
api = tweepy.API(auth)
# thats it. you can start doing stuff that requires authentication =)
api.update_status('tweepy + oauth!')
任何人,我希望能帮助您实现您想要实现的目标? 如果有的话,tweepy 在 http://joshthecoder.github.com/tweepy/docs/index.html 上有很好的文档 (相信我,它很容易阅读)
干杯
