def _respond_401(realm, key, accept_charset, debug, **kwargs):
    """Respond with 401 status and a WWW-Authenticate header."""
    header = www_authenticate(
        realm,
        key,
        accept_charset=accept_charset,
        **kwargs,
    )
    if debug:
        TRACE(header)
    cherrypy.serving.response.headers['WWW-Authenticate'] = header
    raise cherrypy.HTTPError(
        401,
        'You are not authorized to access that resource',
    )
Respond with 401 status and a WWW-Authenticate header.
cherrypy/lib/auth_digest.py