Skip to content

Commit

Permalink
Adding response.headers to on_error method in twython.streaming.api #503
Browse files Browse the repository at this point in the history
  • Loading branch information
domeniconappo committed Nov 19, 2018
1 parent c9e8a46 commit 02995d7
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions twython/streaming/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ def _send(retry_counter):
self.on_timeout()
else:
if response.status_code != 200:
self.on_error(response.status_code, response.content)
self.on_error(response.status_code, response.content, response.headers)

if self.retry_count and \
(self.retry_count - retry_counter) > 0:
Expand Down Expand Up @@ -178,7 +178,7 @@ def on_success(self, data): # pragma: no cover
"""
return True

def on_error(self, status_code, data): # pragma: no cover
def on_error(self, status_code, data, headers=None): # pragma: no cover
"""Called when stream returns non-200 status code
Feel free to override this to handle your streaming data how you
Expand All @@ -189,6 +189,9 @@ def on_error(self, status_code, data): # pragma: no cover
:param data: Error message sent from stream
:type data: dict
:param headers: Response headers sent from the stream (i.e. Retry-After)
:type headers: dict
"""
return

Expand Down

0 comments on commit 02995d7

Please sign in to comment.