为什么 Twitter API 在生产中返回 400 错误?
我有一个在本地运行得非常好的 Twitter 应用程序 - 它搜索关键字,然后使用 Hpricot 来解析 xml 来获取每个用户的信息,例如
Hpricot(open("http://twitter.com/users/show/" +myuser+".xml"))
在本地工作正常,但当我喜欢时它会失败。查看我的日志,我收到此错误:
OpenURI::HTTPError (400 Bad Request):
奇怪的是,有时它会起作用。
这几天来,这个问题反复出现,让我抓狂。会拥抱任何有解决方案的人:)
I have a Twitter app that works fantastic locally - it searches for keywords then for each user it grabs their info using Hpricot to parse the xml e.g.
Hpricot(open("http://twitter.com/users/show/"+myuser+".xml"))
Works fine locally but when I go love it fails. Looking at my log I get this error:
OpenURI::HTTPError (400 Bad Request):
The weird thing is though, sometimes it works.
This has been a recurring problem for a few days now and driving me nuts. Will hug anyone with a solution :)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这几乎肯定是速率限制 - http://apiwiki.twitter.com/HTTP -响应代码和错误。之前没有见过除了速率限制之外的任何其他情况返回 400 秒,尽管文档说可能会有一条附带消息更准确地告诉您出了什么问题。
您或许可以将更多查询列入白名单,请参阅 http://twitter.com/help/request_whitelisting .
It's almost definitely rate-limiting - http://apiwiki.twitter.com/HTTP-Response-Codes-and-Errors . Haven't seen 400s returned for anything other than rate limit before, though the docs say there could be an accompanying message that tells you more exactly what's wrong.
You might be able to get whitelisted for more queries, see http://twitter.com/help/request_whitelisting .
您可能提出了太多要求。您每小时可以进行 150 次未经身份验证的 REST API 调用。
You are probably making too many requests. You are allowed to make 150 REST API calls per hour unauthenticated.