Merge pull request #157 from AyliD/patch-1

Update ws_client.py to support proxy
This commit is contained in:
Kubernetes Prow Robot 2019-09-23 18:39:25 -07:00 committed by GitHub
commit 6ca7a5b732
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -76,7 +76,11 @@ class WSClient:
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):