quart.exceptions module

exception quart.exceptions.BadRequest(status: Optional[http.HTTPStatus] = None)

Bases: quart.exceptions.HTTPStatusException

status = 400
exception quart.exceptions.Forbidden(status: Optional[http.HTTPStatus] = None)

Bases: quart.exceptions.HTTPStatusException

status = 403
exception quart.exceptions.HTTPException(status_code: int, description: str, name: str)

Bases: Exception

get_body() → str

Get the HTML body.

get_headers() → dict
get_response()quart.wrappers.response.Response
exception quart.exceptions.HTTPStatusException(status: Optional[http.HTTPStatus] = None)

Bases: quart.exceptions.HTTPException

status = 500
exception quart.exceptions.MethodNotAllowed(allowed_methods: Optional[Iterable[str]] = None)

Bases: quart.exceptions.HTTPStatusException

get_headers() → dict
exception quart.exceptions.NotAcceptable(status: Optional[http.HTTPStatus] = None)

Bases: quart.exceptions.HTTPStatusException

status = 406
exception quart.exceptions.NotFound(status: Optional[http.HTTPStatus] = None)

Bases: quart.exceptions.HTTPStatusException

status = 404
exception quart.exceptions.RedirectRequired(redirect_path: str)

Bases: quart.exceptions.HTTPStatusException

get_body() → str

Get the HTML body.

get_headers() → dict
exception quart.exceptions.RequestEntityTooLarge(status: Optional[http.HTTPStatus] = None)

Bases: quart.exceptions.HTTPStatusException

status = 413
exception quart.exceptions.RequestRangeNotSatisfiable(complete_length: Optional[int] = None)

Bases: quart.exceptions.HTTPStatusException

get_headers() → dict
status = 416
exception quart.exceptions.RequestTimeout(status: Optional[http.HTTPStatus] = None)

Bases: quart.exceptions.HTTPStatusException

status = 408
exception quart.exceptions.TooManyRequests(status: Optional[http.HTTPStatus] = None)

Bases: quart.exceptions.HTTPStatusException

status = 429
exception quart.exceptions.Unauthorized(status: Optional[http.HTTPStatus] = None)

Bases: quart.exceptions.HTTPStatusException

status = 401
exception quart.exceptions.UnavailableForLegalReasons

Bases: quart.exceptions.HTTPException

quart.exceptions.abort(status_or_response: Union[int, quart.wrappers.response.Response], description: Optional[str] = None, name: Optional[str] = None) → NoReturn

Raises a HTTPException with the status code or response given.

This can be used either with a status code (with optional description and name) or with a Response object. The latter allows for an abort (after response functions etc aren’t called) with a custom response.

abort(403)
abort(Response("Message"))