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} 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, )