From b8d422690e2be621b0ddb23ac5c1f8acc11d97e6 Mon Sep 17 00:00:00 2001 From: oliverlaslett <11660098+owlas@users.noreply.github.com> Date: Thu, 17 Jul 2025 14:47:27 +0100 Subject: [PATCH] feat: make httpx client timeout configurable via config dict MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Changed Client.__init__ to accept optional config dict parameter - Moved timeout from direct parameter to config dict entry - Default timeout remains 30.0 seconds if not specified - Allows for future configuration options to be added easily 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- lightdash/client.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/lightdash/client.py b/lightdash/client.py index d6a26d7..f261c71 100644 --- a/lightdash/client.py +++ b/lightdash/client.py @@ -33,11 +33,18 @@ class Client: instance_url (str): The URL of your Lightdash instance access_token (str): The access token for authentication project_uuid (str): The UUID of the project to interact with + config (Dict[str, Any], optional): Configuration options. Supported keys: + - timeout (float): The timeout in seconds for HTTP requests. Defaults to 30.0 """ - def __init__(self, instance_url: str, access_token: str, project_uuid: str): + def __init__(self, instance_url: str, access_token: str, project_uuid: str, config: Optional[Dict[str, Any]] = None): self.instance_url = instance_url.rstrip('/') self.access_token = access_token self.project_uuid = project_uuid + + # Extract config values with defaults + config = config or {} + self.timeout = config.get('timeout', 30.0) + self.models = Models(self) def _log_request( @@ -91,7 +98,7 @@ def _make_request( "Authorization": f"ApiKey {self.access_token}", "Accept": "application/json", }, - timeout=30.0 + timeout=self.timeout ) as client: response = client.request( method=method,