MCPcopy
hub / github.com/pallets/werkzeug / www_authenticate

Method www_authenticate

src/werkzeug/sansio/response.py:561–598  ·  view source on GitHub ↗

The ``WWW-Authenticate`` header parsed into a :class:`.WWWAuthenticate` object. Modifying the object will modify the header value. This header is not set by default. To set this header, assign an instance of :class:`.WWWAuthenticate` to this attribute. .. code-block

(self)

Source from the content-addressed store, hash-verified

559
560 @property
561 def www_authenticate(self) -> WWWAuthenticate:
562 """The ``WWW-Authenticate`` header parsed into a :class:`.WWWAuthenticate`
563 object. Modifying the object will modify the header value.
564
565 This header is not set by default. To set this header, assign an instance of
566 :class:`.WWWAuthenticate` to this attribute.
567
568 .. code-block:: python
569
570 response.www_authenticate = WWWAuthenticate(
571 "basic", {"realm": "Authentication Required"}
572 )
573
574 Multiple values for this header can be sent to give the client multiple options.
575 Assign a list to set multiple headers. However, modifying the items in the list
576 will not automatically update the header values, and accessing this attribute
577 will only ever return the first value.
578
579 To unset this header, assign ``None`` or use ``del``.
580
581 .. versionchanged:: 2.3
582 This attribute can be assigned to set the header. A list can be assigned
583 to set multiple header values. Use ``del`` to unset the header.
584
585 .. versionchanged:: 2.3
586 :class:`WWWAuthenticate` is no longer a ``dict``. The ``token`` attribute
587 was added for auth challenges that use a token instead of parameters.
588 """
589 value = WWWAuthenticate.from_header(self.headers.get("WWW-Authenticate"))
590
591 if value is None:
592 value = WWWAuthenticate("basic")
593
594 def on_update(value: WWWAuthenticate) -> None:
595 self.www_authenticate = value
596
597 value._on_update = on_update
598 return value
599
600 @www_authenticate.setter
601 def www_authenticate(

Callers

nothing calls this directly

Calls 6

WWWAuthenticateClass · 0.85
from_headerMethod · 0.45
getMethod · 0.45
setMethod · 0.45
to_headerMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected