From 27617181b1d41ee0af3746b8f90c4159f0dcd2bd Mon Sep 17 00:00:00 2001 From: Diego Allen Date: Sun, 31 Aug 2014 23:14:49 -0400 Subject: [PATCH 1/2] Fix issue #317 TwythonRateLimitError.retry_after is always None. --- twython/api.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/twython/api.py b/twython/api.py index 3a37909..499b83b 100644 --- a/twython/api.py +++ b/twython/api.py @@ -194,8 +194,7 @@ class Twython(EndpointsMixin, object): raise ExceptionType(error_message, error_code=response.status_code, - retry_after=response.headers.get('retry-\ - after')) + retry_after=response.headers.get('X-Rate-Limit-Reset')) try: content = response.json() @@ -497,8 +496,7 @@ class Twython(EndpointsMixin, object): # Add 1 to the id because since_id and # max_id are inclusive if hasattr(function, 'iter_metadata'): - since_id = content[function.iter_metadata]\ - .get('since_id_str') + since_id = content[function.iter_metadata].get('since_id_str') else: since_id = content[0]['id_str'] params['since_id'] = (int(since_id) - 1) From f2a535b2508b9bb1f622b34d74994838af810bfe Mon Sep 17 00:00:00 2001 From: Diego Allen Date: Mon, 1 Sep 2014 09:06:07 -0400 Subject: [PATCH 2/2] Formatting fixes --- twython/api.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/twython/api.py b/twython/api.py index 499b83b..6e33904 100644 --- a/twython/api.py +++ b/twython/api.py @@ -192,9 +192,10 @@ class Twython(EndpointsMixin, object): # app keys/user tokens ExceptionType = TwythonAuthError - raise ExceptionType(error_message, - error_code=response.status_code, - retry_after=response.headers.get('X-Rate-Limit-Reset')) + raise ExceptionType( + error_message, + error_code=response.status_code, + retry_after=response.headers.get('X-Rate-Limit-Reset')) try: content = response.json()