pyfoo / python-twitter

Automatically exported from code.google.com/p/python-twitter
Apache License 2.0
0 stars 0 forks source link

user not found leaks urllib2 exception #76

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
If you use the API to search for a user that does not exist, python-twitter 
does not catch the urllib2 
exception. The attached patch corrects the issue, making python-twitter raise a 
TwitterError 
instead.

Original issue reported on code.google.com by carlos.s...@gmail.com on 2 Jun 2009 at 10:35

Attachments:

GoogleCodeExporter commented 9 years ago
That's a bit stupid. HTTPError will also be raised when user has closed his 
account,
when your ip or account is blocked, and even when twitter is down, etc. And you 
will
always think that user does not exist? You can not do it that way.

Check this: http://apiwiki.twitter.com/HTTP-Response-Codes-and-Errors

Original comment by wac...@gmail.com on 3 Jun 2009 at 5:27

GoogleCodeExporter commented 9 years ago
You're right - my biggest issue was stylistic, to be honest. It seems like 
having to import urllib2 just to catch that 
exception is not the right way to do it. Perhaps replace the "user not found" 
string with a more generic entry? 
Maybe the best solution would be to parse the actual error to create the 
correct string, but that's a bit too much 
work.

Original comment by carlos.s...@gmail.com on 3 Jun 2009 at 8:18

GoogleCodeExporter commented 9 years ago
Not to much. You have to do this if you need a fully automatic machine.

Here's a part of how i'm working with it:
http://paste.pocoo.org/show/120950/

Original comment by wac...@gmail.com on 4 Jun 2009 at 10:04