class documentation

class HTTPException(Exception):

Known subclasses: werkzeug.exceptions.BadGateway, werkzeug.exceptions.BadRequest, werkzeug.exceptions.Conflict, werkzeug.exceptions.ExpectationFailed, werkzeug.exceptions.FailedDependency, werkzeug.exceptions.Forbidden, werkzeug.exceptions.GatewayTimeout, werkzeug.exceptions.Gone, werkzeug.exceptions.HTTPVersionNotSupported, werkzeug.exceptions.ImATeapot, werkzeug.exceptions.InternalServerError, werkzeug.exceptions.LengthRequired, werkzeug.exceptions.Locked, werkzeug.exceptions.MethodNotAllowed, werkzeug.exceptions.NotAcceptable, werkzeug.exceptions.NotFound, werkzeug.exceptions.NotImplemented, werkzeug.exceptions.PreconditionFailed, werkzeug.exceptions.PreconditionRequired, werkzeug.exceptions.RequestedRangeNotSatisfiable, werkzeug.exceptions.RequestEntityTooLarge, werkzeug.exceptions.RequestHeaderFieldsTooLarge, werkzeug.exceptions.RequestTimeout, werkzeug.exceptions.RequestURITooLarge, werkzeug.exceptions.Unauthorized, werkzeug.exceptions.UnavailableForLegalReasons, werkzeug.exceptions.UnprocessableEntity, werkzeug.exceptions.UnsupportedMediaType, werkzeug.routing.RequestRedirect, werkzeug.exceptions._RetryAfter

View In Hierarchy

The base class for all HTTP exceptions. This exception can be called as a WSGI application to render a default error page or you can catch the subclasses of it independently and render nicer error messages.
Class Method wrap Create an exception that is a subclass of the calling HTTP exception and the exception argument.
Method __call__ Call the exception as WSGI application.
Method __init__ Undocumented
Method __repr__ Undocumented
Method __str__ Undocumented
Method get​_body Get the HTML body.
Method get​_description Get the description.
Method get​_headers Get a list of headers.
Method get​_response Get a response object. If one was passed to the exception it's returned directly.
Class Variable code Undocumented
Instance Variable description Undocumented
Instance Variable response Undocumented
Property name The status name.
@classmethod
def wrap(cls, exception, name=None):

Create an exception that is a subclass of the calling HTTP exception and the exception argument.

The first argument to the class will be passed to the wrapped exception, the rest to the HTTP exception. If e.args is not empty and e.show_exception is True, the wrapped exception message is added to the HTTP error description.

Deprecated since version 2.0: Will be removed in Werkzeug 2.1. Create a subclass manually instead.
Changed in version 0.15.5: The show_exception attribute controls whether the description includes the wrapped exception message.
Changed in version 0.15.0: The description includes the wrapped exception message.
Parameters
exception:t.Type[BaseException]Undocumented
name:t.Optional[str]Undocumented
Returns
t.Type[HTTPException]Undocumented
def __call__(self, environ, start_response):
Call the exception as WSGI application.
Parameters
environ:WSGIEnvironmentthe WSGI environment.
start​_response:StartResponsethe response callable provided by the WSGI server.
Returns
t.Iterable[bytes]Undocumented
def __repr__(self):

Undocumented

Returns
strUndocumented
def __str__(self):

Undocumented

Returns
strUndocumented
def get_body(self, environ=None, scope=None):
Get the HTML body.
Parameters
environ:t.Optional[WSGIEnvironment]Undocumented
scope:t.Optional[dict]Undocumented
Returns
strUndocumented
def get_description(self, environ=None, scope=None):
Get the description.
Parameters
environ:t.Optional[WSGIEnvironment]Undocumented
scope:t.Optional[dict]Undocumented
Returns
strUndocumented
def get_headers(self, environ=None, scope=None):
Get a list of headers.
Parameters
environ:t.Optional[WSGIEnvironment]Undocumented
scope:t.Optional[dict]Undocumented
Returns
t.List[t.Tuple[str, str]]Undocumented
def get_response(self, environ=None, scope=None):
Get a response object. If one was passed to the exception it's returned directly.
Parameters
environ:t.Optional[t.Union[WSGIEnvironment, WSGIRequest]]the optional environ for the request. This can be used to modify the response depending on how the request looked like.
scope:t.Optional[dict]Undocumented
Returns
Responsea Response object or a subclass thereof.
response =

Undocumented

@property
name: str =
The status name.