def _get_token(request):
    """
    Gets authentication token from request header
    Will raise 401 error if token not found
    :return token: an authorization token.
    """
    token = request.headers.get('Authorization')
    if not token:
        message = 'Token not in Authorization header'
        logging.warning(message)
        raise HTTPError(401, message)
    return token
def _get_token ( request ) : token = request . headers . get ( 'Authorization' ) if not token : message = 'Token not in Authorization header' logging . warning ( message ) raise HTTPError ( 401 , message ) return token
Gets authentication token from request header
    Will raise 401 error if token not found
    :return token: an authorization token.