From 7f0751c27eb97fd4e888c6e5b4447af2b12bfbc5 Mon Sep 17 00:00:00 2001 From: Guru Devanla Date: Tue, 15 Jan 2013 16:40:57 -0600 Subject: [PATCH 1/2] Update error code for Twitter Rate Limits. This is for Twitter Api 1.1 --- twython/twython.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/twython/twython.py b/twython/twython.py index 49c2f65..2e2edb9 100644 --- a/twython/twython.py +++ b/twython/twython.py @@ -203,7 +203,7 @@ class Twython(object): 'error', 'An error occurred processing your request.') self._last_call['api_error'] = error_msg - exceptionType = TwythonRateLimitError if response.status_code == 420 else TwythonError + exceptionType = TwythonRateLimitError if response.status_code == 429 else TwythonError raise exceptionType(error_msg, error_code=response.status_code, From a28febb0b4283be0d3d024bd9bd3709898d4a14c Mon Sep 17 00:00:00 2001 From: Guru Devanla Date: Tue, 15 Jan 2013 16:43:50 -0600 Subject: [PATCH 2/2] update error code and comment --- twython/twython.py | 1 + 1 file changed, 1 insertion(+) diff --git a/twython/twython.py b/twython/twython.py index 2e2edb9..631b34e 100644 --- a/twython/twython.py +++ b/twython/twython.py @@ -203,6 +203,7 @@ class Twython(object): 'error', 'An error occurred processing your request.') self._last_call['api_error'] = error_msg + #Twitter API 1.1 , always return 429 when rate limit is exceeded exceptionType = TwythonRateLimitError if response.status_code == 429 else TwythonError raise exceptionType(error_msg,