From bb613d64208249b70ea0d27354c9b4a6fd6df4e9 Mon Sep 17 00:00:00 2001 From: vivan070707-ctrl Date: Tue, 24 Mar 2026 20:29:52 +0530 Subject: [PATCH] Implement authentication error handling in client.py Added error handling for 401 and 403 status codes. --- axme_sdk/client.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/axme_sdk/client.py b/axme_sdk/client.py index 52ed4b4..2a0c95e 100644 --- a/axme_sdk/client.py +++ b/axme_sdk/client.py @@ -1652,6 +1652,17 @@ def _request_json( json=json_body, headers=headers, ) + if response.status_code == 401: + raise AxmeAuthError( + 401, + "API key invalid — check AXME_API_KEY or run `axme login`", + ) + + if response.status_code == 403: + raise AxmeAuthError( + 403, + "Access denied — insufficient permissions", + ) except (httpx.TimeoutException, httpx.TransportError): if attempt_idx >= attempts - 1: raise