@@ -33,11 +33,13 @@ class Client:
33
33
instance_url (str): The URL of your Lightdash instance
34
34
access_token (str): The access token for authentication
35
35
project_uuid (str): The UUID of the project to interact with
36
+ proxy_authorization (str): An optional value for the proxy authorization header
36
37
"""
37
- def __init__ (self , instance_url : str , access_token : str , project_uuid : str ):
38
+ def __init__ (self , instance_url : str , access_token : str , project_uuid : str , proxy_authorization : Optional [ str ] = None ):
38
39
self .instance_url = instance_url .rstrip ('/' )
39
40
self .access_token = access_token
40
41
self .project_uuid = project_uuid
42
+ self .proxy_authorization = proxy_authorization
41
43
self .models = Models (self )
42
44
43
45
def _log_request (
@@ -85,12 +87,16 @@ def _make_request(
85
87
"""
86
88
url = urljoin (self .instance_url , path )
87
89
self ._log_request (method , url , params , json )
88
-
89
- with httpx .Client (
90
- headers = {
90
+
91
+ headers = {
91
92
"Authorization" : f"ApiKey { self .access_token } " ,
92
93
"Accept" : "application/json" ,
93
- },
94
+ }
95
+ if self .proxy_authorization is not None :
96
+ headers ["Proxy-Authorization" ] = self .proxy_authorization
97
+
98
+ with httpx .Client (
99
+ headers = headers ,
94
100
timeout = 30.0
95
101
) as client :
96
102
response = client .request (
@@ -158,4 +164,4 @@ def list_models(self) -> List[Model]:
158
164
LightdashError: If the API returns an error response
159
165
httpx.HTTPError: If there's a network or HTTP protocol error
160
166
"""
161
- return self .models .list ()
167
+ return self .models .list ()
0 commit comments