@@ -33,11 +33,13 @@ 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+ proxy_authorization (str): An optional value for the proxy authorization header
3637 """
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 ):
3839 self .instance_url = instance_url .rstrip ('/' )
3940 self .access_token = access_token
4041 self .project_uuid = project_uuid
42+ self .proxy_authorization = proxy_authorization
4143 self .models = Models (self )
4244
4345 def _log_request (
@@ -85,12 +87,16 @@ def _make_request(
8587 """
8688 url = urljoin (self .instance_url , path )
8789 self ._log_request (method , url , params , json )
88-
89- with httpx .Client (
90- headers = {
90+
91+ headers = {
9192 "Authorization" : f"ApiKey { self .access_token } " ,
9293 "Accept" : "application/json" ,
93- },
94+ }
95+ if self .proxy_authentication is not None :
96+ headers ["Proxy-Authorization" ] = self .proxy_authorization
97+
98+ with httpx .Client (
99+ headers = headers ,
94100 timeout = 30.0
95101 ) as client :
96102 response = client .request (
@@ -158,4 +164,4 @@ def list_models(self) -> List[Model]:
158164 LightdashError: If the API returns an error response
159165 httpx.HTTPError: If there's a network or HTTP protocol error
160166 """
161- return self .models .list ()
167+ return self .models .list ()
0 commit comments