exception documentation

class MethodNotAllowed(HTTPException): (source)

View In Hierarchy

*405* `Method Not Allowed` Raise if the server used a method the resource does not handle. For example `POST` if the resource is view only. Especially useful for REST. The first argument for this exception should be a list of allowed methods. Strictly speaking the response would be invalid if you don't provide valid methods in the header which you can do with that list.

Method __init__ Takes an optional list of valid http methods starting with werkzeug 0.3 the list will be mandatory.
Method get_headers Get a list of headers.
Class Variable code Undocumented
Class Variable description Undocumented
Instance Variable valid_methods Undocumented

Inherited from HTTPException:

Method __call__ Call the exception as WSGI application.
Method __repr__ Undocumented
Method __str__ Undocumented
Method get_body Get the HTML body.
Method get_description Get the description.
Method get_response Get a response object. If one was passed to the exception it's returned directly.
Instance Variable response Undocumented
Property name The status name.
def __init__(self, valid_methods: t.Optional[t.Iterable[str]] = None, description: t.Optional[str] = None, response: t.Optional[Response] = None): (source)

Takes an optional list of valid http methods starting with werkzeug 0.3 the list will be mandatory.

def get_headers(self, environ: t.Optional[WSGIEnvironment] = None, scope: t.Optional[dict] = None) -> t.List[t.Tuple[str, str]]: (source)

Get a list of headers.

valid_methods = (source)

Undocumented