From 140f6c926a5b89c504048af72e2fe2b1532b3f05 Mon Sep 17 00:00:00 2001 From: Mondo Diaz Date: Thu, 29 Jan 2026 16:40:06 -0600 Subject: [PATCH] Fix httpx.Timeout configuration in PyPI proxy httpx.Timeout requires either a default value or all four parameters. Changed to httpx.Timeout(default, connect=X) format. --- backend/app/pypi_proxy.py | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/backend/app/pypi_proxy.py b/backend/app/pypi_proxy.py index 4b26145..c6f225f 100644 --- a/backend/app/pypi_proxy.py +++ b/backend/app/pypi_proxy.py @@ -156,10 +156,7 @@ async def pypi_simple_index( simple_url = source.url.rstrip('/') + '/simple/' - timeout = httpx.Timeout( - connect=PROXY_CONNECT_TIMEOUT, - read=PROXY_READ_TIMEOUT, - ) + timeout = httpx.Timeout(PROXY_READ_TIMEOUT, connect=PROXY_CONNECT_TIMEOUT) with httpx.Client(timeout=timeout, follow_redirects=False) as client: response = client.get( @@ -247,10 +244,7 @@ async def pypi_package_versions( package_url = source.url.rstrip('/') + f'/simple/{normalized_name}/' - timeout = httpx.Timeout( - connect=PROXY_CONNECT_TIMEOUT, - read=PROXY_READ_TIMEOUT, - ) + timeout = httpx.Timeout(PROXY_READ_TIMEOUT, connect=PROXY_CONNECT_TIMEOUT) with httpx.Client(timeout=timeout, follow_redirects=False) as client: response = client.get( @@ -385,10 +379,7 @@ async def pypi_download_file( headers.update(_build_auth_headers(matched_source)) auth = _get_basic_auth(matched_source) if matched_source else None - timeout = httpx.Timeout( - connect=PROXY_CONNECT_TIMEOUT, - read=300.0, # 5 minutes for large files - ) + timeout = httpx.Timeout(300.0, connect=PROXY_CONNECT_TIMEOUT) # 5 minutes for large files # Fetch the file logger.info(f"PyPI proxy: fetching {filename} from {upstream_url}")