laurentS / slowapi

A rate limiter for Starlette and FastAPI
https://pypi.org/project/slowapi/
MIT License
1.21k stars 76 forks source link

Pass request object to limiter callbacks #41

Open dlindenkreuz opened 3 years ago

dlindenkreuz commented 3 years ago

The request object cannot be accessed easily in some of the limiter callbacks (limit_value, exempt_when). Support for this would be really useful. This already seems to work with key_func which gets passed the request if the callback declares a request parameter.

This would also remove the need for the workaround from https://github.com/laurentS/slowapi/issues/13.

Kavan72 commented 3 years ago

@laurentS do you have any plan to add this in near future ?

fredi-python commented 11 months ago

Are there any news to that?

iursevla commented 1 month ago

Yeah, this is mandatory if we want to get some configuration from the request