From 2e957b654ed54f7d7c2b92166517f4d15deee240 Mon Sep 17 00:00:00 2001 From: Harmon Date: Sat, 23 Jan 2021 14:23:48 -0600 Subject: [PATCH] Return thread when using threaded Stream.filter and Stream.sample --- tweepy/streaming.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tweepy/streaming.py b/tweepy/streaming.py index ece9fe2..0d5e74c 100644 --- a/tweepy/streaming.py +++ b/tweepy/streaming.py @@ -230,6 +230,7 @@ class Stream: self.thread = Thread(target=self._connect, name="Tweepy Stream", args=args, kwargs=kwargs, daemon=self.daemon) self.thread.start() + return self.thread def filter(self, *, follow=None, track=None, locations=None, filter_level=None, languages=None, stall_warnings=False, @@ -257,7 +258,7 @@ class Stream: body['stall_warnings'] = stall_warnings if threaded: - self._threaded_connect(endpoint, body=body) + return self._threaded_connect(endpoint, body=body) else: self._connect(endpoint, body=body) @@ -274,7 +275,7 @@ class Stream: params['stall_warnings'] = 'true' if threaded: - self._threaded_connect(endpoint, params=params) + return self._threaded_connect(endpoint, params=params) else: self._connect(endpoint, params=params) -- 2.25.1