Skip to content
This repository was archived by the owner on Mar 13, 2022. It is now read-only.

Commit 34f3d05

Browse files
authored
Update ws_client.py to support proxy
1 parent 4b8e89f commit 34f3d05

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

stream/ws_client.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,11 @@ def __init__(self, configuration, url, headers):
7474
ssl_opts['keyfile'] = configuration.key_file
7575

7676
self.sock = WebSocket(sslopt=ssl_opts, skip_utf8_validation=False)
77-
self.sock.connect(url, header=header)
77+
if configuration.proxy:
78+
proxy_url = urlparse(configuration.proxy)
79+
self.sock.connect(url, header=header, http_proxy_host=proxy_url.hostname, http_proxy_port=proxy_url.port)
80+
else:
81+
self.sock.connect(url, header=header)
7882
self._connected = True
7983

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

0 commit comments

Comments
 (0)