Skip to content

Commit 4bfd5c1

Browse files
owlasclaude
andauthored
feat: make httpx client timeout configurable via config dict (#11)
Co-authored-by: Claude <noreply@anthropic.com>
1 parent e7fe534 commit 4bfd5c1

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

lightdash/client.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,18 @@ class Client:
3333
instance_url (str): The URL of your Lightdash instance
3434
access_token (str): The access token for authentication
3535
project_uuid (str): The UUID of the project to interact with
36+
config (Dict[str, Any], optional): Configuration options. Supported keys:
37+
- timeout (float): The timeout in seconds for HTTP requests. Defaults to 30.0
3638
"""
37-
def __init__(self, instance_url: str, access_token: str, project_uuid: str):
39+
def __init__(self, instance_url: str, access_token: str, project_uuid: str, config: Optional[Dict[str, Any]] = None):
3840
self.instance_url = instance_url.rstrip('/')
3941
self.access_token = access_token
4042
self.project_uuid = project_uuid
43+
44+
# Extract config values with defaults
45+
config = config or {}
46+
self.timeout = config.get('timeout', 30.0)
47+
4148
self.models = Models(self)
4249

4350
def _log_request(
@@ -91,7 +98,7 @@ def _make_request(
9198
"Authorization": f"ApiKey {self.access_token}",
9299
"Accept": "application/json",
93100
},
94-
timeout=30.0
101+
timeout=self.timeout
95102
) as client:
96103
response = client.request(
97104
method=method,

0 commit comments

Comments
 (0)