开发者

Why does Twitter API return a 400 error in production?

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 :)


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 .


You are probably making too many requests. You are allowed to make 150 REST API calls per hour unauthenticated.

REST API Rate Limiting

  • Unauthenticated calls are permitted 150 requests per hour. Unauthenticated calls are measured against the public facing IP of the server or device making the request.
  • OAuth calls are permitted 350 requests per hour and are measured against the oauth_token used in the request.
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜