Allow using lists and dicts for passing proxy settings

This commit is contained in:
Dmitry D. Chernov
2017-06-05 14:04:01 +10:00
committed by Lonami
parent 3de398bae6
commit 5362f2578d
2 changed files with 6 additions and 3 deletions

View File

@@ -25,7 +25,10 @@ class TcpClient:
else:
import socks
self._socket = socks.socksocket(socket.AF_INET, socket.SOCK_STREAM)
self._socket.set_proxy(*self._proxy)
if type(self._proxy) is dict:
self._socket.set_proxy(**self._proxy)
else: # tuple, list, etc.
self._socket.set_proxy(*self._proxy)
def connect(self, ip, port):
"""Connects to the specified IP and port number"""