mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2024-11-27 03:43:45 +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()
|
self.disconnect()
|
||||||
return self.connect()
|
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
|
# endregion
|
||||||
|
|
||||||
# region Working with different connections/Data Centers
|
# region Working with different connections/Data Centers
|
||||||
|
|
Loading…
Reference in New Issue
Block a user