(request, response, realm, users)
return unauthorized(request, response)
Perform Digest Authentication

    If auth fails, raise 401 with a digest authentication header.

    :param realm: The authentication realm.
    :type  realm: str

    :param users: A dict of the form: {username: password} or a callable
                  returning a dict.
    :type  users: dict or callable
Perform Digest Authentication
Perform Digest Authentication
def digest_auth(request, response, realm, users):
    """Perform Digest Authentication

    If auth fails, raise 401 with a digest authentication header.

    :param realm: The authentication realm.
    :type  realm: str

    :param users: A dict of the form: {username: password} or a callable
                  returning a dict.
    :type  users: dict or callable
    """

    if check_auth(request, response, realm, users):
        return

    # inform the user-agent this path is protected
    response.headers["WWW-Authenticate"] = _httpauth.digestAuth(realm)

    return unauthorized(request, response)
def digest_auth ( request , response , realm , users ) : if check_auth ( request , response , realm , users ) : return # inform the user-agent this path is protected response . headers [ "WWW-Authenticate" ] = _httpauth . digestAuth ( realm ) return unauthorized ( request , response )