Merge pull request #504 from domeniconappo/503-add_response_headers_on_error
Adding response.headers to on_error method in twython.streaming.api #503
This commit is contained in:
commit
9ccc576221
1 changed files with 5 additions and 2 deletions
|
|
@ -125,7 +125,7 @@ class TwythonStreamer(object):
|
||||||
self.on_timeout()
|
self.on_timeout()
|
||||||
else:
|
else:
|
||||||
if response.status_code != 200:
|
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 \
|
if self.retry_count and \
|
||||||
(self.retry_count - retry_counter) > 0:
|
(self.retry_count - retry_counter) > 0:
|
||||||
|
|
@ -178,7 +178,7 @@ class TwythonStreamer(object):
|
||||||
"""
|
"""
|
||||||
return True
|
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
|
"""Called when stream returns non-200 status code
|
||||||
|
|
||||||
Feel free to override this to handle your streaming data how you
|
Feel free to override this to handle your streaming data how you
|
||||||
|
|
@ -189,6 +189,9 @@ class TwythonStreamer(object):
|
||||||
|
|
||||||
:param data: Error message sent from stream
|
:param data: Error message sent from stream
|
||||||
:type data: dict
|
:type data: dict
|
||||||
|
|
||||||
|
:param headers: Response headers sent from the stream (i.e. Retry-After)
|
||||||
|
:type headers: dict
|
||||||
"""
|
"""
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue