From 8f69b11878231cb99e001fe33d660ef01feaa041 Mon Sep 17 00:00:00 2001 From: Harmon Date: Fri, 25 Feb 2022 14:59:15 -0600 Subject: [PATCH] Use asyncio.create_task in AsyncStream.filter and AsyncStream.sample --- tweepy/asynchronous/streaming.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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): -- 2.25.1