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

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

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
@@ -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)