INNER CODE UNIT · Python

__limit_decorator

laurentS/slowapi · slowapi/extension.py:652

    def __limit_decorator(
        self,
        limit_value: StrOrCallableStr,
        key_func: Optional[Callable[..., str]] = None,
        shared: bool = False,
        scope: Optional[StrOrCallableStr] = None,
        per_method: bool = False,
        methods: Optional[List[str]] = None,
        error_message: Optional[str] = None,
        exempt_when: Optional[Callable[..., bool]] = None,
        cost: Union[int, Callable[..., int]] = 1,
        override_defaults: bool = True,
    ) -> Callable[..., Any]:
        _scope = scope if shared else None

        def decorator(func: Callable[..., Response]):
            keyfunc = key_func or self._key_func
            name = f"{func.__module__}.{func.__name__}"

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…