pyniryo_nate.exceptions.ApiError

exception pyniryo_nate.exceptions.ApiError(status_code: int, response: str, message: str | None = None)[source]

Exception raised when an API request fails.

Parameters:
  • status_code (int) – The HTTP status code of the response.

  • response (str) – The response body text.

  • message (str | None) – An optional custom error message.

Variables:
  • reason – The explanation the server gave, or the raw body when it gave none.

  • code – The machine readable reason the server gave, e.g. robot_held or no_execution, None when it gave none. A client that does not know the code it receives falls back to reason.

  • details – What the refusal is about, keyed by name. Which keys are present depends on code.

Return type:

None