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

[Ehancement] Don't require Request parameter to be present in endpoint function signature. #174

Open
ThirVondukr opened this issue Nov 7, 2023 · 4 comments

Comments

@ThirVondukr
Copy link

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

@waterfountain1996
Copy link

waterfountain1996 commented Nov 10, 2023

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.

@paulocoutinhox
Copy link

It was done? Can anyone create a PR or put the code here? Thanks.

@ThirVondukr
Copy link
Author

ThirVondukr commented May 10, 2024

@paulocoutinhox I never received an answer from maintainer(s), so no 😓
If it as contributed somewhere, then I simply don't know about it

@paulocoutinhox
Copy link

Im using this with success:
https://github.com/santunioni/ThrottledAPI

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

3 participants