diff --git a/litellm/proxy/client/teams.py b/litellm/proxy/client/teams.py index dc6fa1e228a..38d494f70e4 100644 --- a/litellm/proxy/client/teams.py +++ b/litellm/proxy/client/teams.py @@ -65,7 +65,9 @@ class TeamsManagementClient: response: Final = requests.get(url, headers=self._get_headers(), params=params, timeout=self._timeout) if response.status_code == 401: - raise UnauthorizedError("Authentication failed. Check your API key.") + raise UnauthorizedError( + requests.exceptions.HTTPError("Authentication failed. Check your API key.", response=response) + ) response.raise_for_status() return response.json() @@ -122,7 +124,9 @@ class TeamsManagementClient: response: Final = requests.get(url, headers=self._get_headers(), params=params, timeout=self._timeout) if response.status_code == 401: - raise UnauthorizedError("Authentication failed. Check your API key.") + raise UnauthorizedError( + requests.exceptions.HTTPError("Authentication failed. Check your API key.", response=response) + ) response.raise_for_status() return response.json() @@ -143,7 +147,9 @@ class TeamsManagementClient: response: Final = requests.get(url, headers=self._get_headers(), timeout=self._timeout) if response.status_code == 401: - raise UnauthorizedError("Authentication failed. Check your API key.") + raise UnauthorizedError( + requests.exceptions.HTTPError("Authentication failed. Check your API key.", response=response) + ) response.raise_for_status() return response.json() diff --git a/tests/unit/proxy/client/cli/test_auto_sign_in.py b/tests/unit/proxy/client/cli/test_auto_sign_in.py index f63a07fc5e4..e01ac6eb762 100644 --- a/tests/unit/proxy/client/cli/test_auto_sign_in.py +++ b/tests/unit/proxy/client/cli/test_auto_sign_in.py @@ -541,8 +541,12 @@ def test_a_rejected_explicit_key_fails_cleanly_without_opening_a_browser( @pytest.mark.parametrize( ("command", "method", "path"), - [(["users", "list"], "GET", "/user/list"), (["keys", "generate"], "POST", "/key/generate")], - ids=["users", "keys"], + [ + (["users", "list"], "GET", "/user/list"), + (["keys", "generate"], "POST", "/key/generate"), + (["teams", "list"], "GET", "/team/list"), + ], + ids=["users", "keys", "teams"], ) def test_a_rejected_explicit_key_names_the_reason_the_proxy_gave_without_echoing_the_key( requests_mock: Mocker,