gpt4 book ai didi

python - Tweepy exists_friendship 不存在?

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

这不是我的全部代码,而是有问题的部分。

api = tweepy.API(auth)
x = api.exists_friendship(user_a, user_b)
print x

返回

x = api.exists_friendships(user_a, user_b)
AttributeError: 'API' object has no attribute 'exists_friendships'

有人知道为什么吗?真的会有帮助!谢谢。

最佳答案

您收到错误是因为 api 中没有这样的方法。您很可能正在关注较早的教程,而且我认为即使是官方文档也尚未更新,即使它在一年多前已更改...

Twitter API 在 1.1 版中发生了变化,并添加了身份验证作为一项要求。这也导致关系查找端点发生变化,因此 Tweepy API 发生了变化。

您可以在此处找到有关新 Twitter API 的更多信息:https://dev.twitter.com/rest/reference/get/friendships/lookup

Tweepy为此提供的新函数是:lookup_friendships .

关于python - Tweepy exists_friendship 不存在?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27651547/

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