xyzspaces.exceptions module¶
This module defines API exceptions.
- exception xyzspaces.exceptions.AuthenticationError[source]¶
Bases:
Exception
Exception raised when authentication fails.
- exception xyzspaces.exceptions.ApiError[source]¶
Bases:
Exception
Exception raised for API HTTP response status codes not in [200…300).
The exception value will be the response object returned by
requests
which provides access to all its attributes, eg.status_code
,reason
andtext
, etc.Example:
>>> try: >>> import os >>> os.environ["XYZ_TOKEN"] = "MY-XYZ-TOKEN" >>> api = HubApi() >>> 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:
Exception
Exception 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
requests
which provides access to all its attributes, eg.status_code
,reason
andtext
, etc.