Skip to content

Commit 6ca7a5b

Browse files
authored
Merge pull request #157 from AyliD/patch-1
Update ws_client.py to support proxy
2 parents af42f24 + 34f3d05 commit 6ca7a5b

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

stream/ws_client.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,11 @@ def __init__(self, configuration, url, headers):
7676
ssl_opts['keyfile'] = configuration.key_file
7777

7878
self.sock = WebSocket(sslopt=ssl_opts, skip_utf8_validation=False)
79-
self.sock.connect(url, header=header)
79+
if configuration.proxy:
80+
proxy_url = urlparse(configuration.proxy)
81+
self.sock.connect(url, header=header, http_proxy_host=proxy_url.hostname, http_proxy_port=proxy_url.port)
82+
else:
83+
self.sock.connect(url, header=header)
8084
self._connected = True
8185

8286
def peek_channel(self, channel, timeout=0):

0 commit comments

Comments
 (0)