From ae01c42dff506d1502f8b55700cee823363003e5 Mon Sep 17 00:00:00 2001 From: Stainless Bot Date: Sun, 13 Aug 2023 22:15:11 +0000 Subject: [PATCH] feat: allow a default timeout to be set for clients --- README.md | 2 +- src/finch/_base_client.py | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 3229aa78..639d2622 100644 --- a/README.md +++ b/README.md @@ -205,7 +205,7 @@ client.with_options(max_retries=5).hris.directory.list_individuals() ### Timeouts -Requests time out after 60 seconds by default. You can configure this with a `timeout` option, +Requests time out after 1 minute by default. You can configure this with a `timeout` option, which accepts a float or an [`httpx.Timeout`](https://www.python-httpx.org/advanced/#fine-tuning-the-configuration): ```python diff --git a/src/finch/_base_client.py b/src/finch/_base_client.py index d646f53a..cf1d62b4 100644 --- a/src/finch/_base_client.py +++ b/src/finch/_base_client.py @@ -82,6 +82,7 @@ _AsyncStreamT = TypeVar("_AsyncStreamT", bound=AsyncStream[Any]) +# default timeout is 1 minute DEFAULT_TIMEOUT = Timeout(timeout=60.0, connect=5.0) DEFAULT_MAX_RETRIES = 2 DEFAULT_LIMITS = Limits(max_connections=100, max_keepalive_connections=20)