Utility Classes¶
Exceptions¶
ActionError¶
-
exception
doapi.
ActionError
(action)[source]¶ Bases:
exceptions.Exception
New in version 0.2.0.
Raised when
raise_for_error()
is called on anAction
that failed to complete successfully
DOAPIError¶
-
exception
doapi.
DOAPIError
(response)[source]¶ Bases:
exceptions.Exception
An exception raised in reaction to the API endpoint responding with a 4xx or 5xx error. Any method that performs an API request may raise this error.
If the body of the error response is a JSON object, its fields will be added to the
DOAPIError
‘s attributes (except where a pre-existing attribute would be overwritten). DigitalOcean error response bodies have been observed to consist of an object with two string fields,"id"
and"message"
.Note that this class is only for representing errors reported by the endpoint in response to API requests. Everything else that can go wrong uses the normal Python exceptions.
-
response
= None¶ The
requests.Response
object
-
http_error_msg
= None¶ An error message that should be appropriate for human consumption, containing the type of HTTP error, the URL that was requested, and the body of the response.
-
WaitTimeoutError¶
-
exception
doapi.
WaitTimeoutError
(in_progress, attr, value, wait_interval, wait_time)[source]¶ Bases:
exceptions.Exception
New in version 0.2.0.
Raised when the runtime of a
wait
method exceedswait_time
-
in_progress
= None¶ A list of any waited-on objects that have not yet completed
-
attr
= None¶ The objects’ attribute that was being monitored
-
wait_interval
= None¶ The
wait_interval
value for the wait operation
-
wait_time
= None¶ The
wait_time
value for the wait operation
-
DOEncoder¶
-
class
doapi.
DOEncoder
(skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, sort_keys=False, indent=None, separators=None, encoding='utf-8', default=None)[source]¶ Bases:
json.encoder.JSONEncoder
A
json.JSONEncoder
subclass that converts resource objects todict
s for JSONification. It also converts iterators to lists.