From 94c98c0573f289f770f0a017dbaad6b3cdb22633 Mon Sep 17 00:00:00 2001 From: Carlo Minotti <50220438+minottic@users.noreply.github.com> Date: Fri, 5 Dec 2025 18:20:07 +0100 Subject: [PATCH 1/2] fix: token_prefix default to empty string --- sdk/python/scilog/scicat.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/python/scilog/scicat.py b/sdk/python/scilog/scicat.py index 5e2c8577..8b112430 100644 --- a/sdk/python/scilog/scicat.py +++ b/sdk/python/scilog/scicat.py @@ -6,7 +6,7 @@ class SciCatRestAPI(HttpClient): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.login_path = self._login_path or "https://dacat.psi.ch/auth/msad" - self.token_prefix = self.options.get("token_prefix", "") + self.token_prefix = self.options.get("token_prefix", "") or "" def authenticate(self, username, password): auth_payload = {"username": username, "password": password} From 93605cb5fe8dcd8660599f9aea7cf865f185ca23 Mon Sep 17 00:00:00 2001 From: Carlo Minotti <50220438+minottic@users.noreply.github.com> Date: Fri, 5 Dec 2025 18:21:14 +0100 Subject: [PATCH 2/2] Add test --- sdk/python/tests/test_scicat.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sdk/python/tests/test_scicat.py b/sdk/python/tests/test_scicat.py index e9a84bce..a1566554 100644 --- a/sdk/python/tests/test_scicat.py +++ b/sdk/python/tests/test_scicat.py @@ -11,6 +11,7 @@ "token_prefix", [ "", + None, "Bearer ", ], ) @@ -41,7 +42,7 @@ def test_get_proposals(mock_post, mock_get, token_prefix): mock_post.assert_called_with( f"{address}/proposals", params=None, - headers={**headers, "Authorization": f"{token_prefix}{token}"}, + headers={**headers, "Authorization": f"{token_prefix or ''}{token}"}, timeout=ANY, verify=True, )