After recently updating Gwibber to the latest daily version, I noticed that I was regularly getting the below error and that nothing was showing up in my Twitter timeline:
HTTPError: HTTP Error 400: Bad Request
The Traceback is as below:
Traceback (most recent call last):
File "/usr/lib/python2.6/dist-packages/gwibber/microblog/__init__.py", line 50, in get_data
for message in method(client):
File "/usr/lib/python2.6/dist-packages/gwibber/microblog/twitter.py", line 207, in responses
for data in self.get_direct_messages():
File "/usr/lib/python2.6/dist-packages/gwibber/microblog/twitter.py", line 182, in get_direct_messages
"https://twitter.com/direct_messages.json"))
File "/usr/lib/python2.6/dist-packages/gwibber/microblog/twitter.py", line 158, in connect
url, data, headers = {"Authorization": self.get_auth()})).read()
File "/usr/lib/python2.6/urllib2.py", line 124, in urlopen
return _opener.open(url, data, timeout)
File "/usr/lib/python2.6/urllib2.py", line 389, in open
response = meth(req, response)
File "/usr/lib/python2.6/urllib2.py", line 502, in http_response
'http', request, response, code, msg, hdrs)
File "/usr/lib/python2.6/urllib2.py", line 427, in error
return self._call_chain(*args)
File "/usr/lib/python2.6/urllib2.py", line 361, in _call_chain
result = func(*args)
File "/usr/lib/python2.6/urllib2.py", line 510, in http_error_default
raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
HTTPError: HTTP Error 400: Bad Request
At first I thought that this was a problem with Gwibber, however, after a bit of research, it turns out that this is a problem at Twitters end. Basically, Twitter recently changed their API and now limits the number of update requests you can make per hour using Gwibber. If you have your Gwibber client set to update too regularly (i.e. every minute or so) then it will run out of update permissions before the hour is over and you will get lots of error messages. It is therefore recommended to set the update frequency to something a bit higher (5 minutes should be fine) and hopefully you shouldn’t see the error any more.
If you want to know how many more Twitter update requests you have remaining (for the current hour), there is a simple curl command that you can enter in a terminal that will prompt you for a password and then provide the info you need.
$ user@jonoxps:~$ curl -u yourusernamehere http://twitter.com/account/rate_limit_status.json
$ Enter host password for user 'yourusernamehere':
$ {"reset_time_in_seconds":1243702342,"remaining_hits":0,"hourly_limit":100,"reset_time":"Sat May 30 16:52:22 +0000 2009"}
Sure enough, as soon as the clock turned 16:52:22, my hourly_limit went back up to 100 and Gwibber started working again!
Hopefully that should clear things up for a few of you, there is more information about the bug on Launchpad.