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

Commit

Permalink
Update ws_client.py to support proxy
Browse files Browse the repository at this point in the history
  • Loading branch information
AyliD committed Aug 29, 2019
1 parent 4b8e89f commit 34f3d05
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion stream/ws_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,11 @@ def __init__(self, configuration, url, headers):
ssl_opts['keyfile'] = configuration.key_file

self.sock = WebSocket(sslopt=ssl_opts, skip_utf8_validation=False)
self.sock.connect(url, header=header)
if configuration.proxy:
proxy_url = urlparse(configuration.proxy)
self.sock.connect(url, header=header, http_proxy_host=proxy_url.hostname, http_proxy_port=proxy_url.port)
else:
self.sock.connect(url, header=header)
self._connected = True

def peek_channel(self, channel, timeout=0):
Expand Down

0 comments on commit 34f3d05

Please sign in to comment.