mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2024-11-23 01:46:35 +03:00
TelegramBareClient: Add set_proxy() method
This allows to change proxy without recreation of the client instance.
This commit is contained in:
parent
a5b1457eee
commit
fa64a5f7b8
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue
Block a user