Need Rate Limiting on Basis of Request Body for a POST API #179
-
We have a FASTAPI Post Route, where we want to rate limit based on a parameter passed in the request body. How to achieve this behaviour in a slowapi decorator? So that |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 6 replies
-
I am also facing the same issue. |
Beta Was this translation helpful? Give feedback.
-
I think #13 might help. As a side note, I converted the issue into a discussion. The issue tracker is meant for bug reporting, etc... rather than Q&A like this. |
Beta Was this translation helpful? Give feedback.
-
I think for it to work correctly, the lib would need to be reworked a bit, from a decorator to a dependency. In one of our project we have a very ugly but working method to kind of use slowapi as a dependency without rewriting the whole lib. I could maybe share it somewhere (for some reason, I though I already did in a previous issue but couldn't find it) for reference, if you confirm that I understood the issue correctly |
Beta Was this translation helpful? Give feedback.
-
Yes @thentgesMindee we are trying to access the POST Request Body, in the decorator. If you can search for it, can you please put the reference of the workaround solution here? |
Beta Was this translation helpful? Give feedback.
sure, sorry for the time I took! Here is a quick example, with comments: