gpt4 book ai didi

python - Tweepy 和 SocialRegistration 问题

转载 作者:太空宇宙 更新时间:2023-11-04 06:28:58 25 4
gpt4 key购买 nike

我已经成功安装了 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 上有很好的文档(相信我,它很容易阅读)

干杯

关于python - Tweepy 和 SocialRegistration 问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5147700/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com