Exceptions¶
All exceptions are importable from the top-level almaapitk package. Catch the
base AlmaAPIError to handle any API failure, or a specific subclass for
targeted handling. AlmaValidationError (and its subclass CredentialError)
derive from ValueError.
AlmaAPIError
¶
AlmaAPIError(
message: str,
status_code: int = None,
response=None,
tracking_id: Optional[str] = None,
alma_code: str = "",
)
Bases: Exception
General Alma API error.
Carries the HTTP status, the underlying requests.Response, and --
when the failing response body included an Alma errorList payload --
the per-error trackingId and errorCode Ex Libris support uses
to investigate cases (issue #10). Both fields default to safe
sentinels (None / "") so call sites that construct exceptions
without a parsed body (tests, the typed-subclass constructors, the
legacy (message, status_code, response) positional path used
pre-#10) keep working unchanged.
Attributes:
| Name | Type | Description |
|---|---|---|
status_code |
HTTP status code of the failing response, or |
|
response |
The underlying |
|
tracking_id |
The |
|
alma_code |
The |
Source code in src/almaapitk/client/AlmaAPIClient.py
AlmaValidationError
¶
Bases: ValueError
Validation error for Alma API requests.
AlmaAuthenticationError
¶
AlmaAuthenticationError(
message: str,
status_code: int = None,
response=None,
tracking_id: Optional[str] = None,
alma_code: str = "",
)
Bases: AlmaAPIError
API authentication failed (HTTP 401).
Source code in src/almaapitk/client/AlmaAPIClient.py
AlmaRateLimitError
¶
AlmaRateLimitError(
message: str,
status_code: int = None,
response=None,
tracking_id: Optional[str] = None,
alma_code: str = "",
)
Bases: AlmaAPIError
Alma API rate limit exceeded (HTTP 429).
Source code in src/almaapitk/client/AlmaAPIClient.py
AlmaServerError
¶
AlmaServerError(
message: str,
status_code: int = None,
response=None,
tracking_id: Optional[str] = None,
alma_code: str = "",
)
Bases: AlmaAPIError
Alma server-side error (HTTP 5xx).
Source code in src/almaapitk/client/AlmaAPIClient.py
AlmaResourceNotFoundError
¶
AlmaResourceNotFoundError(
message: str,
status_code: int = None,
response=None,
tracking_id: Optional[str] = None,
alma_code: str = "",
)
Bases: AlmaAPIError
Requested Alma resource was not found (HTTP 404).
Source code in src/almaapitk/client/AlmaAPIClient.py
AlmaDuplicateInvoiceError
¶
AlmaDuplicateInvoiceError(
message: str,
status_code: int = None,
response=None,
tracking_id: Optional[str] = None,
alma_code: str = "",
)
Bases: AlmaAPIError
Invoice already exists for the given vendor (Alma error code 402459).
Source code in src/almaapitk/client/AlmaAPIClient.py
AlmaInvalidPolModeError
¶
AlmaInvalidPolModeError(
message: str,
status_code: int = None,
response=None,
tracking_id: Optional[str] = None,
alma_code: str = "",
)
Bases: AlmaAPIError
POL is not in the right mode for the requested operation (Alma error code 40166411).
Source code in src/almaapitk/client/AlmaAPIClient.py
CredentialError
¶
Bases: AlmaValidationError
No API key could be resolved for the client (issue #143).
Raised by AlmaAPIClient when neither an explicit api_key=
argument nor the environment-variable fallback supplies a key.
Subclasses AlmaValidationError (and therefore ValueError) so
that callers who caught the old bare ValueError on a missing key
continue to work unchanged.