Client errors

Documentation of client errors generated from Azion’s ReST API.

Exceptions used to describe errors when handling Azion API requests/responses.

Documentation of possible errors to be returned from the API can be found here: https://www.azion.com.br/developers/api-v1/#status-codes

exception azion.exceptions.AzionError(response)

This class represents all errors related to response.

Whenever Azion’s API returns a error code, we catch them and provide a better and uniform way to handle/inspect them.

response

HTTP response that originated the error.

status_code

HTTP status code raised by the error.

errors

List of errors generated from the response.

exception azion.exceptions.AzionException

Base class exception. All exceptions related to requests/responses errors are inherited from it.

exception azion.exceptions.BadRequest(response)

Indicate that the server could not understand the request due to invalid syntax.

More info here: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/400

exception azion.exceptions.Conflict(response)

Indicate a request conflict with current state of the server.

exception azion.exceptions.Forbidden(response)

Indicate that the server understood the request but refuses to authorize it.

More info here: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/403

exception azion.exceptions.MethodNotAllowed(response)

Indicate that the request method is known by the server but has been disabled and cannot be used.

More info here: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/405

exception azion.exceptions.NotAcceptable(response)

Indicate that a response matching the list of acceptable values defined in Accept-Charset and Accept-Language cannot be served.

More info here: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/406

exception azion.exceptions.NotFound(response)

Indicate that the server can’t find the requested resource. Links which lead to a 404 page are often called broken or dead links.

More info here: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/404

exception azion.exceptions.TooManyRequests(response)

Indicate he user has sent too many requests in a given amount of time (“rate limiting”).

More info here: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429

exception azion.exceptions.Unauthorized(response)

Indicate that the request has not been applied because it lacks valid authentication credentials for the target resource.

More info here: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/401

azion.exceptions.handle_error(response)

Handle the request that failed to retrieve an appropriate response.

Parameters:response (object) – requests Response object.