Add proxy support using PySocks (closes #37)

This commit is contained in:
Epix Zhang
2017-03-21 00:16:34 +08:00
committed by Lonami
parent b4c81a60b3
commit 350c11d66f
5 changed files with 35 additions and 8 deletions

View File

@@ -45,7 +45,7 @@ class TelegramClient:
# region Initialization
def __init__(self, session, api_id, api_hash):
def __init__(self, session, api_id, api_hash, proxy=None):
"""Initializes the Telegram client with the specified API ID and Hash.
Session can either be a `str` object (the filename for the loaded/saved .session)
@@ -72,7 +72,7 @@ class TelegramClient:
'The given session must either be a string or a Session instance.')
self.transport = TcpTransport(self.session.server_address,
self.session.port)
self.session.port, proxy)
# These will be set later
self.dc_options = None