def _get_auth(): if has_request_context() and not hasattr(_request_ctx_stack.top, 'api_auth'): return default_auth_data return getattr(_request_ctx_stack.top, 'api_auth', None)