added 403 response code for private tweets

This commit is contained in:
Thomas Wiedenbein 2010-09-08 02:58:11 +08:00 committed by rmmh
parent 8372502ea5
commit f626801646
1 changed files with 3 additions and 2 deletions

View File

@ -88,6 +88,7 @@ def twitter(inp):
except http.HTTPError, e: except http.HTTPError, e:
errors = {400: 'bad request (ratelimited?)', errors = {400: 'bad request (ratelimited?)',
401: 'tweet is private', 401: 'tweet is private',
403: 'tweet is private',
404: 'invalid user/id', 404: 'invalid user/id',
500: 'twitter is broken', 500: 'twitter is broken',
502: 'twitter is down ("getting upgraded")', 502: 'twitter is down ("getting upgraded")',
@ -96,7 +97,7 @@ def twitter(inp):
return 'error: invalid ' + ['username', 'tweet id'][getting_id] return 'error: invalid ' + ['username', 'tweet id'][getting_id]
if e.code in errors: if e.code in errors:
return 'error: ' + errors[e.code] return 'error: ' + errors[e.code]
return 'error: unknown' return 'error: unknown %s' % e.code
except http.URLerror, e: except http.URLerror, e:
return 'error: timeout' return 'error: timeout'