def get_request_data( cls, request: HttpRequest, api: "NinjaAPI", path_params: DictStrAny ) -> Optional[DictStrAny]: data = {} headers = get_headers(request) for name in cls._flatten_map: if name in headers: data[name] = headers[name] return data
def get_request_data(cls, request, api, path_params): data = {} headers = get_headers(request) for name, field in cls.__fields__.items(): if name in headers: data[name] = headers[name] elif field.alias in headers: data[field.alias] = headers[field.alias] return data
def get_request_data( cls, request: HttpRequest, api: "NinjaAPI", path_params: DictStrAny ) -> Optional[DictStrAny]: data = {} headers = get_headers(request) for name, field in cls.__fields__.items(): if name in headers: data[name] = headers[name] elif field.alias in headers: data[field.alias] = headers[field.alias] return data
def __call__(self, request): headers = get_headers(request) auth_value = headers.get(self.header) if not auth_value: return try: username, password = self.decode_authorization(auth_value) except DecodeError as e: print(e) return return self.authenticate(request, username, password)
def __call__(self, request): headers = get_headers(request) auth_value = headers.get(self.header) if not auth_value: return parts = auth_value.split(" ") if parts[0].lower() != "bearer": print(f"Unexpected auth - '{auth_value}'") return token = " ".join(parts[1:]) return self.authenticate(request, token)
def __call__(self, request: HttpRequest) -> Optional[Any]: headers = get_headers(request) auth_value = headers.get(self.header) if not auth_value: return None try: username, password = self.decode_authorization(auth_value) except DecodeError as e: if settings.DEBUG: logger.exception(e) return None return self.authenticate(request, username, password)
def __call__(self, request: HttpRequest) -> Optional[Any]: headers = get_headers(request) auth_value = headers.get(self.header) if not auth_value: return None parts = auth_value.split(" ") if parts[0].lower() != self.openapi_scheme: if settings.DEBUG: logger.error(f"Unexpected auth - '{auth_value}'") return None token = " ".join(parts[1:]) return self.authenticate(request, token)