Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Any way to reset limit under source function? #21

Open
kirillzhosul opened this issue Jun 8, 2022 · 1 comment
Open

Any way to reset limit under source function? #21

kirillzhosul opened this issue Jun 8, 2022 · 1 comment

Comments

@kirillzhosul
Copy link

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)?

@kirillzhosul
Copy link
Author

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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant