diff --git a/passwork_client/modules/api_client.py b/passwork_client/modules/api_client.py index 7d22602..2f29292 100644 --- a/passwork_client/modules/api_client.py +++ b/passwork_client/modules/api_client.py @@ -55,7 +55,10 @@ def call(self, method: str, endpoint: str, payload: dict | None = None, headers: def _process_response(self, response): """Process API response and handle errors.""" - data = response.json() + try: + data = response.json() + except json.JSONDecodeError: + raise PassworkError(f"Response not in JSON format. Text: {response.text}") result = data if data and isinstance(data, dict):