Use asyncio.create_task in AsyncStream.filter and AsyncStream.sample
authorHarmon <Harmon758@gmail.com>
Fri, 25 Feb 2022 20:59:15 +0000 (14:59 -0600)
committerHarmon <Harmon758@gmail.com>
Fri, 25 Feb 2022 20:59:15 +0000 (14:59 -0600)
tweepy/asynchronous/streaming.py

index 7b06e50fb744f2c4e56ec1895d9bd69d4f0121bf..fb698eec5984269d6928448a36d8e01c539c792d 100644 (file)
@@ -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):