我正在将我的应用程序从 Twitter API 版本 1 移动到 1.1,并且遇到了友谊/创建问题。
根据 1.1 文档(https://dev.twitter.com/docs/api/1.1/post/friendships/create)friendships/create 没有速率限制,但是当我调用friendships/create 时,我可以看到速率限制是 15(根据“x-rate-limit-limit”)。
我在这里做错了吗?每个时间窗口的速率限制真的是 15 次吗?
我正在将我的应用程序从 Twitter API 版本 1 移动到 1.1,并且遇到了友谊/创建问题。
根据 1.1 文档(https://dev.twitter.com/docs/api/1.1/post/friendships/create)friendships/create 没有速率限制,但是当我调用friendships/create 时,我可以看到速率限制是 15(根据“x-rate-limit-limit”)。
我在这里做错了吗?每个时间窗口的速率限制真的是 15 次吗?
冉找到了解决办法:
我使用 twitter gem,当您调用 follow 它时,它首先会调用friends/ids 以确保您尚未关注该成员,并且 /friends/ids 限制为每个窗口 15 个调用。
解决方案是调用
follow!
(使用 ! )来避免检查。
根据关于建立友谊的新 Twitter API 文档:
如果用户已经是用户的朋友,则可能会返回 HTTP 403,但出于性能原因,即使关注关系已经存在,此方法也可能返回 HTTP 200 OK 消息。