From a52c4ea81ef806ff00a58a96b0640c842b98a2a2 Mon Sep 17 00:00:00 2001 From: Taekyoon Date: Mon, 15 Aug 2016 11:38:55 +0900 Subject: [PATCH] Implement proxy support for ClientSession.ws_connect #1025 Maybe.. Done.. I didn't check by Test mock.... But you said this would beeee OK... Hopefully ^^ This is my first commit. --- aiohttp/client.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/aiohttp/client.py b/aiohttp/client.py index 30202e6c336..6edfe4b8ffc 100644 --- a/aiohttp/client.py +++ b/aiohttp/client.py @@ -260,7 +260,9 @@ def ws_connect(self, url, *, autoping=True, auth=None, origin=None, - headers=None): + headers=None, + proxy=None, + proxy_auth=None): """Initiate websocket connection.""" return _WSRequestContextManager( self._ws_connect(url, @@ -270,7 +272,9 @@ def ws_connect(self, url, *, autoping=autoping, auth=auth, origin=origin, - headers=headers)) + headers=headers, + proxy=proxy, + proxy_auth=proxy_auth)) @asyncio.coroutine def _ws_connect(self, url, *, @@ -280,7 +284,9 @@ def _ws_connect(self, url, *, autoping=True, auth=None, origin=None, - headers=None): + headers=None, + proxy=None, + proxy_auth=None): sec_key = base64.b64encode(os.urandom(16)) @@ -306,7 +312,9 @@ def _ws_connect(self, url, *, # send request resp = yield from self.get(url, headers=headers, read_until_eof=False, - auth=auth) + auth=auth, + proxy=proxy, + proxy_auth=proxy_auth) try: # check handshake