Skip to content

Commit c9b27d0

Browse files
BorisYourichmartenson
authored andcommitted
TesClient private_token destination for OAuth2 Authorization
Added private_token destination and Headers for OAuth2 Authorization in Tes client as was done in pydantic-tes TesClient .
1 parent d513711 commit c9b27d0

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

pulsar/managers/util/tes.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,13 @@ def ensure_tes_client() -> None:
4141

4242
def tes_client_from_dict(destination_params: Dict[str, Any]) -> TesClient:
4343
# 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+
token = destination_params.get("private_token")
46+
headers = {}
47+
if token:
48+
headers["Authorization"] = f"Bearer {token}"
49+
50+
return TesClient(url=tes_url, headers=headers)
4851

4952

5053
def tes_resources(destination_params: Dict[str, Any]) -> TesResources:

0 commit comments

Comments
 (0)