From 068b117a9a603f3193d225779ff90623e60cfa22 Mon Sep 17 00:00:00 2001 From: Thomas Chopitea Date: Mon, 1 Sep 2025 12:03:13 +0000 Subject: [PATCH] Add TLS certificate support in YetiApi initialization and authentication --- yeti/api.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/yeti/api.py b/yeti/api.py index abf75f8..dc0e82e 100644 --- a/yeti/api.py +++ b/yeti/api.py @@ -74,8 +74,11 @@ class YetiApi: _url_root: The root URL of the Yeti API. """ - def __init__(self, url_root: str): + def __init__(self, url_root: str, tls_cert: str | None = None): self.client = requests.Session() + self._tls_cert = tls_cert + if tls_cert: + self.client.verify = self._tls_cert self._headers = { "Content-Type": "application/json", } @@ -171,6 +174,8 @@ def auth_api_key(self, apikey: str | None = None) -> None: f"Failed to find access token in the response: {response}" ) authd_session = requests.Session() + if self._tls_cert: + authd_session.verify = self._tls_cert authd_session.headers.update({"authorization": f"Bearer {access_token}"}) self.client = authd_session