From: Harmon Date: Fri, 25 Feb 2022 20:59:15 +0000 (-0600) Subject: Use asyncio.create_task in AsyncStream.filter and AsyncStream.sample X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=8f69b11878231cb99e001fe33d660ef01feaa041;p=tweepy.git Use asyncio.create_task in AsyncStream.filter and AsyncStream.sample --- diff --git a/tweepy/asynchronous/streaming.py b/tweepy/asynchronous/streaming.py index 7b06e50..fb698ee 100644 --- a/tweepy/asynchronous/streaming.py +++ b/tweepy/asynchronous/streaming.py @@ -229,10 +229,10 @@ class AsyncStream: if stall_warnings: body["stall_warnings"] = "true" - self.task = asyncio.ensure_future( + self.task = asyncio.create_task( self._connect("POST", endpoint, headers=headers, body=body or None) ) - # Use create_task when support for Python 3.6 is dropped + # Use name parameter when support for Python 3.7 is dropped return self.task def sample(self, *, languages=None, stall_warnings=False): @@ -280,10 +280,10 @@ class AsyncStream: if stall_warnings: params["stall_warnings"] = "true" - self.task = asyncio.ensure_future( + self.task = asyncio.create_task( self._connect("GET", endpoint, params=params) ) - # Use create_task when support for Python 3.6 is dropped + # Use name parameter when support for Python 3.7 is dropped return self.task def disconnect(self):