From 6cb5931e7a71467cc6e48c9f6f947bb0b6279312 Mon Sep 17 00:00:00 2001 From: Lonami Exo Date: Thu, 4 Jan 2018 23:37:47 +0100 Subject: [PATCH] Call .disconnect() on client.__del__ for convenience --- telethon/telegram_bare_client.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/telethon/telegram_bare_client.py b/telethon/telegram_bare_client.py index 8a0c43d9..93453322 100644 --- a/telethon/telegram_bare_client.py +++ b/telethon/telegram_bare_client.py @@ -270,6 +270,9 @@ class TelegramBareClient: # TODO Shall we clear the _exported_sessions, or may be reused? self._first_request = True # On reconnect it will be first again + def __del__(self): + self.disconnect() + def _reconnect(self, new_dc=None): """If 'new_dc' is not set, only a call to .connect() will be made since it's assumed that the connection has been lost and the