File tree Expand file tree Collapse file tree 1 file changed +16
-5
lines changed Expand file tree Collapse file tree 1 file changed +16
-5
lines changed Original file line number Diff line number Diff line change 1+ import base64
12from typing import (
23 Any ,
34 cast ,
@@ -40,11 +41,21 @@ def ensure_tes_client() -> None:
4041
4142
4243def tes_client_from_dict (destination_params : Dict [str , Any ]) -> TesClient :
43- # TODO: implement funnel's basic auth in pydantic-tes and expose it here.
44- tes_url = destination_params ["tes_url" ]
45- return TesClient (
46- url = tes_url ,
47- )
44+ tes_url = destination_params .get ("tes_url" )
45+ auth_type = destination_params .get ("authorization" , "none" ) # Default to "none"
46+
47+ headers = {}
48+
49+ if auth_type == "basic" :
50+ basic_auth = destination_params .get ("basic_auth" , {})
51+ username = basic_auth .get ("username" )
52+ password = basic_auth .get ("password" )
53+ if username and password :
54+ auth_string = f"{ username } :{ password } "
55+ auth_base64 = base64 .b64encode (auth_string .encode ()).decode ()
56+ headers ["Authorization" ] = f"Basic { auth_base64 } "
57+
58+ return TesClient (url = tes_url , headers = headers )
4859
4960
5061def tes_resources (destination_params : Dict [str , Any ]) -> TesResources :
You can’t perform that action at this time.
0 commit comments