class documentation

class Unauthorized(HTTPException):

View In Hierarchy

401 Unauthorized

Raise if the user is not authorized to access a resource.

The www_authenticate argument should be used to set the WWW-Authenticate header. This is used for HTTP basic auth and other schemes. Use ~werkzeug.datastructures.WWWAuthenticate to create correctly formatted values. Strictly speaking a 401 response is invalid if it doesn't provide at least one value for this header, although real clients typically don't care.

Changed in version 2.0: Serialize multiple www_authenticate items into multiple WWW-Authenticate headers, rather than joining them into a single value, for better interoperability.
Changed in version 0.15.3: If the www_authenticate argument is not set, the WWW-Authenticate header is not set.
Changed in version 0.15.3: The response argument was restored.
Changed in version 0.15.1: description was moved back as the first argument, restoring its previous position.
Changed in version 0.15.0: www_authenticate was added as the first argument, ahead of description.
Parameters
descriptionOverride the default message used for the body of the response.
www-authenticateA single value, or list of values, for the WWW-Authenticate header(s).
Method __init__ Undocumented
Method get​_headers Get a list of headers.
Class Variable code Undocumented
Class Variable description Undocumented
Instance Variable www​_authenticate Undocumented

Inherited from HTTPException:

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 __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, description=None, response=None, www_authenticate=None):

Undocumented

Parameters
description:t.Optional[str]Undocumented
response:t.Optional[Response]Undocumented
www​_authenticate:t.Optional[t.Union[WWWAuthenticate, t.Iterable[WWWAuthenticate]]]Undocumented
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
code: int =
description: str =
www_authenticate =

Undocumented