Double read timeout to fix 'The read operation timed out' (#445)

This commit is contained in:
Hugo van Kemenade 2024-02-04 20:58:44 +02:00 committed by GitHub
commit befb5aeceb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -894,6 +894,7 @@ class _Request:
username = "" if username is None else f"?username={username}" username = "" if username is None else f"?username={username}"
(host_name, host_subdir) = self.network.ws_server (host_name, host_subdir) = self.network.ws_server
timeout = httpx.Timeout(5, read=10)
if self.network.is_proxy_enabled(): if self.network.is_proxy_enabled():
client = httpx.Client( client = httpx.Client(
@ -901,12 +902,14 @@ class _Request:
base_url=f"https://{host_name}", base_url=f"https://{host_name}",
headers=HEADERS, headers=HEADERS,
proxies=self.network.proxy, proxies=self.network.proxy,
timeout=timeout,
) )
else: else:
client = httpx.Client( client = httpx.Client(
verify=SSL_CONTEXT, verify=SSL_CONTEXT,
base_url=f"https://{host_name}", base_url=f"https://{host_name}",
headers=HEADERS, headers=HEADERS,
timeout=timeout,
) )
try: try: