views:

250

answers:

2

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

+1  A: 

You are probably making too many requests. You are allowed to make 150 REST API calls per hour. See http://apiwiki.twitter.com/Rate-limiting

jakber
+1  A: 

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%5Fwhitelisting .

Ben
Great, thanks guys. It's good to finally know what the problem is. Will apply for the whitelisting - wonder how long it takes
Fonziguy