[Ehancement] Don't require `Request` parameter to be present in endpoint function signature.
Opened this issue · 4 comments
It's possible to modify function signature so it would always have a parameter with Request
by assigning a new signature into function.__signature__
, it should allow you to not use the request parameter explicitly (e.g.):
@limiter.limit("...")
async def endpoint():
print("Should work")
Implementation is not that tricky or complex, would you be interested in a PR or just a demo of how it could work? @laurentS
It would be a nice addition indeed. Have bumped into this issue when exploring solutions for rate limiting at work recently. Providing a reference implementation just in case. Can be extended to inject Depends
-based dependencies relatively easily but I don't think that this library needs that anyway.
It was done? Can anyone create a PR or put the code here? Thanks.
@paulocoutinhox I never received an answer from maintainer(s), so no 😓
If it as contributed somewhere, then I simply don't know about it
Im using this with success:
https://github.com/santunioni/ThrottledAPI