diff --git a/telethon/telegram_bare_client.py b/telethon/telegram_bare_client.py index 27acfe9a..8dad6d29 100644 --- a/telethon/telegram_bare_client.py +++ b/telethon/telegram_bare_client.py @@ -299,6 +299,13 @@ class TelegramBareClient: self.disconnect() return self.connect() + def set_proxy(proxy): + """Change the proxy used by the connections. + """ + if self.is_connected(): + raise RuntimeError("You can't change the proxy while connected.") + self._sender.connection.conn.proxy = proxy + # endregion # region Working with different connections/Data Centers