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,
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.
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(in_progress, attr, value, wait_interval, wait_time)¶
New in version 0.2.0.
Raised when the runtime of a
A list of any waited-on objects that have not yet completed
The objects’ attribute that was being monitored
wait_intervalvalue for the wait operation
wait_timevalue for the wait operation
DOEncoder(skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, sort_keys=False, indent=None, separators=None, encoding='utf-8', default=None)¶
Implement this method in a subclass such that it returns a serializable object for
o, or calls the base implementation (to raise a
For example, to support arbitrary iterators, you could implement default like this:
def default(self, o): try: iterable = iter(o) except TypeError: pass else: return list(iterable) # Let the base class default method raise the TypeError return JSONEncoder.default(self, o)