Skip to content

Commit 1c657d8

Browse files
authored
Fix ssl=None not supported on recent versions of aiohttp (#496)
1 parent 2ee2583 commit 1c657d8

File tree

1 file changed

+21
-14
lines changed

1 file changed

+21
-14
lines changed

gql/transport/aiohttp_websockets.py

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -845,7 +845,27 @@ async def connect(self) -> None:
845845
if self.websocket is None and not self._connecting:
846846
self._connecting = True
847847

848-
connect_args: Dict[str, Any] = {}
848+
connect_args: Dict[str, Any] = {
849+
"url": self.url,
850+
"headers": self.headers,
851+
"auth": self.auth,
852+
"heartbeat": self.heartbeat,
853+
"origin": self.origin,
854+
"params": self.params,
855+
"protocols": self.supported_subprotocols,
856+
"proxy": self.proxy,
857+
"proxy_auth": self.proxy_auth,
858+
"proxy_headers": self.proxy_headers,
859+
"timeout": self.websocket_close_timeout,
860+
"receive_timeout": self.receive_timeout,
861+
}
862+
863+
if self.ssl is not None:
864+
connect_args.update(
865+
{
866+
"ssl": self.ssl,
867+
}
868+
)
849869

850870
# Adding custom parameters passed from init
851871
if self.connect_args:
@@ -857,19 +877,6 @@ async def connect(self) -> None:
857877
# Set the _connecting flag to False after in all cases
858878
self.websocket = await asyncio.wait_for(
859879
self.session.ws_connect(
860-
url=self.url,
861-
headers=self.headers,
862-
auth=self.auth,
863-
heartbeat=self.heartbeat,
864-
origin=self.origin,
865-
params=self.params,
866-
protocols=self.supported_subprotocols,
867-
proxy=self.proxy,
868-
proxy_auth=self.proxy_auth,
869-
proxy_headers=self.proxy_headers,
870-
timeout=self.websocket_close_timeout,
871-
receive_timeout=self.receive_timeout,
872-
ssl=self.ssl,
873880
**connect_args,
874881
),
875882
self.connect_timeout,

0 commit comments

Comments
 (0)