From: Harmon Date: Mon, 11 Jan 2021 16:11:13 +0000 (-0600) Subject: Fix AsyncStream reuse X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=e80e1291c7addec5140a29f97de54874677dea3a;p=tweepy.git Fix AsyncStream reuse --- 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"