mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2024-11-22 09:26:37 +03:00
TcpClient: Combine two identical function calls into one
This commit is contained in:
parent
15e06f9ce2
commit
7ffe2b3130
|
@ -11,6 +11,7 @@ from telethon.utils import BinaryWriter
|
|||
class TcpClient:
|
||||
def __init__(self, proxy=None):
|
||||
self.connected = False
|
||||
|
||||
if proxy:
|
||||
try:
|
||||
import socks
|
||||
|
@ -20,8 +21,9 @@ class TcpClient:
|
|||
print("Can't import PySocks, fallback to vanilla socket. "
|
||||
"Proxy settings are ignored. "
|
||||
"Try to install PySocks via pip")
|
||||
self.socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||
else:
|
||||
proxy = None
|
||||
|
||||
if not proxy:
|
||||
self.socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||
|
||||
# Support for multi-threading advantages and safety
|
||||
|
|
Loading…
Reference in New Issue
Block a user