xyzspaces.exceptions module¶
This module defines API exceptions.
-
exception
xyzspaces.exceptions.AuthenticationError[source]¶ Bases:
ExceptionException raised when authentication fails.
-
exception
xyzspaces.exceptions.ApiError[source]¶ Bases:
ExceptionException raised for API HTTP response status codes not in [200…300).
The exception value will be the response object returned by
requestswhich provides access to all its attributes, eg.status_code,reasonandtext, etc.Example:
>>> try: >>> api = HubApi(credentials="MY-XYZ-TOKEN") >>> api.get("/hub/nope").json() >>> except ApiError as e: >>> resp = e.value.args[0] >>> if resp.status_code == 404 and resp.reason == "Not Found": >>> ...
-
exception
xyzspaces.exceptions.TooManyRequestsException[source]¶ Bases:
ExceptionException raised for API HTTP response status code 429.
This is a dedicated exception to be used with the backoff package, because it requires a specific exception class.
The exception value will be the response object returned by
requestswhich provides access to all its attributes, eg.status_code,reasonandtext, etc.