From e9511f7779736777cd4d91f58a797c06c7aa5f78 Mon Sep 17 00:00:00 2001 From: Harmon Date: Tue, 26 Jan 2021 07:48:19 -0600 Subject: [PATCH] Add AsyncStream.on_disconnect method --- tweepy/asynchronous/streaming.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tweepy/asynchronous/streaming.py b/tweepy/asynchronous/streaming.py index 116c70b..8dfb291 100644 --- a/tweepy/asynchronous/streaming.py +++ b/tweepy/asynchronous/streaming.py @@ -141,6 +141,7 @@ class AsyncStream: raise finally: await self.session.close() + await self.on_disconnect() async def filter(self, follow=None, track=None, locations=None, stall_warnings=False): @@ -252,6 +253,13 @@ class AsyncStream: """ log.error("Stream connection has errored or timed out") + async def on_disconnect(self): + """This method is a coroutine. + + This is called when the stream has disconnected. + """ + log.info("Stream disconnected") + async def on_exception(self, exception): """This method is a coroutine. -- 2.25.1