app/views.py
async def secret_based_security(header_param: str = Security(secret_header)):
    """
    Args:
        header_param: parsed header field secret_header
    Returns:
        True if the authentication was successful
    Raises:
        HTTPException if the authentication failed
    """

    if header_param == SECRET:
        return True
    if not header_param:
        error = (
            "Did you forget to add 'Authorization' field to the request header? "
            "You can find the auth key in the '.env' file as 'API_KEY'. "
            "Also, you have to prepend the auth protocol before the token. "
            "For example: 'Authorization: Token <token_value>' "
        )
    else:
        error = (
            "Wrong API auth key. "
            "Did you forget to add 'Authorization' field to the request header? "
            "You can find the auth key in the '.env' file as 'API_KEY'. Also, you have to prepend the auth protocol before the token. "
            "For example: 'Authorization: Token <token_value>' "
        )

    raise HTTPException(status_code=HTTPStatus.FORBIDDEN, detail=error)

    Args:
        header_param: parsed header field secret_header
    Returns:
        True if the authentication was successful
    Raises:
        HTTPException if the authentication failed
    
parsed header field secret_header
Returns:
True if the authentication was successful
Raises:
HTTPException if the authentication failed
parsed header field secret_header Returns : True if the authentication was successful Raises : HTTPException if the authentication failed
async def secret_based_security(header_param: str = Security(secret_header)):
    if header_param == SECRET:
        return True
    if not header_param:
        error = (
            "Did you forget to add 'Authorization' field to the request header? "
            "You can find the auth key in the '.env' file as 'API_KEY'. "
            "Also, you have to prepend the auth protocol before the token. "
            "For example: 'Authorization: Token <token_value>' "
        )
    else:
        error = (
            "Wrong API auth key. "
            "Did you forget to add 'Authorization' field to the request header? "
            "You can find the auth key in the '.env' file as 'API_KEY'. Also, you have to prepend the auth protocol before the token. "
            "For example: 'Authorization: Token <token_value>' "
        )
    raise HTTPException(status_code=HTTPStatus.FORBIDDEN, detail=error)
async def secret_based_security ( header_param : str = Security ( secret_header ) ) : if header_param == SECRET : return True if not header_param : error = ( "Did you forget to add 'Authorization' field to the request header? " "You can find the auth key in the '.env' file as 'API_KEY'. " "Also, you have to prepend the auth protocol before the token. " "For example: 'Authorization: Token <token_value>' " ) else : error = ( "Wrong API auth key. " "Did you forget to add 'Authorization' field to the request header? " "You can find the auth key in the '.env' file as 'API_KEY'. Also, you have to prepend the auth protocol before the token. " "For example: 'Authorization: Token <token_value>' " ) raise HTTPException ( status_code = HTTPStatus . FORBIDDEN , detail = error )
Args:
header_param: parsed header field secret_header
Returns:
True if the authentication was successful
Raises:
HTTPException if the authentication failed
Args : header_param : parsed header field secret_header Returns : True if the authentication was successful Raises : HTTPException if the authentication failed
"""
    Args:
        header_param: parsed header field secret_header
    Returns:
        True if the authentication was successful
    Raises:
        HTTPException if the authentication failed
    """
header_param
str