Skip to content

Fix ssl=None not supported on recent versions of aiohttp on aiohttp_websockets transport #496

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading