fastapi-limiter
fastapi-limiter copied to clipboard
Any way to reset limit under source function?
Hello! Is there any way to reset (call block) limit inside source code of the function (e.g: Set limit once there is some condition under route)?
Tried to research situation. Writen some additional method to the Dependency, allows to call it not from depends.
async def check(self, request: Request, response: Response | None = None):
return await self.__call__(request, response)
Example of using inside router:
await RateLimiter(seconds=1).check(req)
This is maybe a bit messy, but I not found solution for now. (Response inside callback / call is not used by default callback, and I dont found any need for it).