Skip to content

Commit

Permalink
Fix ssl=None not supported on recent versions of aiohttp (#496)
Browse files Browse the repository at this point in the history
  • Loading branch information
leszekhanusz authored Aug 1, 2024
1 parent 2ee2583 commit 1c657d8
Showing 1 changed file with 21 additions and 14 deletions.
35 changes: 21 additions & 14 deletions gql/transport/aiohttp_websockets.py
Original file line number Diff line number Diff line change
Expand Up @@ -845,7 +845,27 @@ async def connect(self) -> None:
if self.websocket is None and not self._connecting:
self._connecting = True

connect_args: Dict[str, Any] = {}
connect_args: Dict[str, Any] = {
"url": self.url,
"headers": self.headers,
"auth": self.auth,
"heartbeat": self.heartbeat,
"origin": self.origin,
"params": self.params,
"protocols": self.supported_subprotocols,
"proxy": self.proxy,
"proxy_auth": self.proxy_auth,
"proxy_headers": self.proxy_headers,
"timeout": self.websocket_close_timeout,
"receive_timeout": self.receive_timeout,
}

if self.ssl is not None:
connect_args.update(
{
"ssl": self.ssl,
}
)

# Adding custom parameters passed from init
if self.connect_args:
Expand All @@ -857,19 +877,6 @@ async def connect(self) -> None:
# Set the _connecting flag to False after in all cases
self.websocket = await asyncio.wait_for(
self.session.ws_connect(
url=self.url,
headers=self.headers,
auth=self.auth,
heartbeat=self.heartbeat,
origin=self.origin,
params=self.params,
protocols=self.supported_subprotocols,
proxy=self.proxy,
proxy_auth=self.proxy_auth,
proxy_headers=self.proxy_headers,
timeout=self.websocket_close_timeout,
receive_timeout=self.receive_timeout,
ssl=self.ssl,
**connect_args,
),
self.connect_timeout,
Expand Down

0 comments on commit 1c657d8

Please sign in to comment.