From e80e1291c7addec5140a29f97de54874677dea3a Mon Sep 17 00:00:00 2001 From: Harmon Date: Mon, 11 Jan 2021 10:11:13 -0600 Subject: [PATCH] Fix AsyncStream reuse --- tweepy/asynchronous/streaming.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tweepy/asynchronous/streaming.py b/tweepy/asynchronous/streaming.py index 39b3913..7433cf6 100644 --- a/tweepy/asynchronous/streaming.py +++ b/tweepy/asynchronous/streaming.py @@ -170,7 +170,7 @@ class AsyncStream: Returns :class:`asyncio.Task` """ - if self.task is not None: + if self.task is not None and not self.task.done(): raise TweepError('Stream is already connected') endpoint = "statuses/filter" @@ -212,7 +212,7 @@ class AsyncStream: Returns :class:`asyncio.Task` """ - if self.task is not None: + if self.task is not None and not self.task.done(): raise TweepError("Stream is already connected") endpoint = "statuses/sample" -- 2.25.1