Fix disconnect message handling in AsyncStream.on_data
authorHarmon <Harmon758@gmail.com>
Tue, 26 Jan 2021 15:39:22 +0000 (09:39 -0600)
committerHarmon <Harmon758@gmail.com>
Tue, 26 Jan 2021 15:39:31 +0000 (09:39 -0600)
tweepy/asynchronous/streaming.py

index dd6cbb2c3feef777650ab5ff5e854c36beb93052..150c617a3f3de079654b6bcc64d26569f079a6b2 100644 (file)
@@ -291,10 +291,12 @@ class AsyncStream:
         if "delete" in data:
             delete = data["delete"]["status"]
             return await self.on_delete(delete["id"], delete["user_id"])
+        if "disconnect" in data:
+            return await self.on_disconnect_message(data["disconnect"])
         if "limit" in data:
             return await self.on_limit(data["limit"]["track"])
-        for message_type in ("disconnect_message", "scrub_geo",
-                             "status_withheld", "user_withheld", "warning"):
+        for message_type in ("scrub_geo","status_withheld", "user_withheld",
+                             "warning"):
             if message_type in data:
                 method = getattr(self, "on_" + message_type)
                 return await method(data[message_type])