From 6749f83582959ea81837f48e67861ef338706107 Mon Sep 17 00:00:00 2001 From: Aaron Hill Date: Tue, 25 Feb 2014 13:37:52 -0500 Subject: [PATCH] Reset session after making request --- tweepy/binder.py | 1 + tweepy/streaming.py | 2 ++ 2 files changed, 3 insertions(+) diff --git a/tweepy/binder.py b/tweepy/binder.py index d3614e3..68074fa 100644 --- a/tweepy/binder.py +++ b/tweepy/binder.py @@ -186,6 +186,7 @@ def bind_api(**config): time.sleep(retry_delay) retries_performed += 1 + self.session = requests.Session() # If an error was returned, throw an exception self.api.last_response = resp if resp.status_code and not 200 <= resp.status_code < 300: diff --git a/tweepy/streaming.py b/tweepy/streaming.py index c1ab0bc..89d81e1 100644 --- a/tweepy/streaming.py +++ b/tweepy/streaming.py @@ -189,6 +189,8 @@ class Stream(object): if resp: resp.close() + self.session = requests.Session() + if exception: # call a handler first so that the exception can be logged. self.listener.on_exception(exception) -- 2.25.1