Can we block whole app when any api's limit is breached ?
mohittgupta opened this issue · comments
Hello,
I want to block whole app for user if exceeds limits of any single api. So , is there any way to do so ?
There isn't any exact built in way to achieve this.
One creative way to do this could be to use an on_breach
callback that you can use to capture the fact that a user has been rate limited and then use the same key_func
to store a flag with the TTL being equal to the amount of time you want to block the user for. Then you can add your own before_request
hook which checks the flag and raises the error you want.
okay , thanks. I will try to implement this idea and get back to you.
@mohittgupta please close the issue if your use case was resolved by the suggestion