diff --git a/baseten/client/_inference.py b/baseten/client/_inference.py index ea199e0..4f87a2b 100644 --- a/baseten/client/_inference.py +++ b/baseten/client/_inference.py @@ -128,9 +128,11 @@ def __init__( # Empty api_key is an advanced opt-out from sending Authorization. if api_key != "": request_headers["Authorization"] = f"Bearer {api_key}" + # No read timeout, matching the JS and Go clients. self._http_client = httpx.Client( base_url=self._options.base_url, headers=with_user_agent(request_headers), + timeout=httpx.Timeout(5.0, read=None), ) self.close_http_client_on_close = ( True @@ -243,9 +245,11 @@ def __init__( # Empty api_key is an advanced opt-out from sending Authorization. if api_key != "": request_headers["Authorization"] = f"Bearer {api_key}" + # No read timeout, matching the JS and Go clients. self._http_client = httpx.AsyncClient( base_url=self._options.base_url, headers=with_user_agent(request_headers), + timeout=httpx.Timeout(5.0, read=None), ) self.close_http_client_on_close = ( True diff --git a/baseten/client/_management.py b/baseten/client/_management.py index b83757c..85dcda2 100644 --- a/baseten/client/_management.py +++ b/baseten/client/_management.py @@ -79,9 +79,11 @@ def __init__( # Empty api_key is an advanced opt-out from sending Authorization. if api_key != "": request_headers["Authorization"] = f"Bearer {api_key}" + # No read timeout, matching the JS and Go clients. self._http_client = httpx.Client( base_url=self._options.base_url, headers=with_user_agent(request_headers), + timeout=httpx.Timeout(5.0, read=None), ) self.close_http_client_on_close = ( True @@ -172,9 +174,11 @@ def __init__( # Empty api_key is an advanced opt-out from sending Authorization. if api_key != "": request_headers["Authorization"] = f"Bearer {api_key}" + # No read timeout, matching the JS and Go clients. self._http_client = httpx.AsyncClient( base_url=self._options.base_url, headers=with_user_agent(request_headers), + timeout=httpx.Timeout(5.0, read=None), ) self.close_http_client_on_close = ( True diff --git a/baseten/client/_sandbox.py b/baseten/client/_sandbox.py index 6d26535..4292c0a 100644 --- a/baseten/client/_sandbox.py +++ b/baseten/client/_sandbox.py @@ -69,9 +69,11 @@ def __init__( # Empty token is an advanced opt-out from sending Authorization. if token != "": request_headers["Authorization"] = f"Bearer {token}" + # No read timeout, matching the JS and Go clients. self._http_client = httpx.Client( base_url=base_url, headers=with_user_agent(request_headers), + timeout=httpx.Timeout(5.0, read=None), ) self.close_http_client_on_close = ( True @@ -156,9 +158,11 @@ def __init__( # Empty token is an advanced opt-out from sending Authorization. if token != "": request_headers["Authorization"] = f"Bearer {token}" + # No read timeout, matching the JS and Go clients. self._http_client = httpx.AsyncClient( base_url=base_url, headers=with_user_agent(request_headers), + timeout=httpx.Timeout(5.0, read=None), ) self.close_http_client_on_close = ( True