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

Include Rate Limiting Support #71

Closed
codylandry opened this issue Feb 17, 2018 · 2 comments
Closed

Include Rate Limiting Support #71

codylandry opened this issue Feb 17, 2018 · 2 comments

Comments

@codylandry
Copy link

I wanted to check in and see if the maintainers thought it would be a good feature to add to uplink. The idea is that you can specify a requests/time period and the consumer would never make request faster than that. It would be up to the user to specify a rate somewhat lower than the actual limit for the api they're wrapping. I could see an issue that would make it unnecessary to add this feature, being that you can only limit the requests a for a single instance. Just wanted to put it up for consideration.

@prkumar
Copy link
Owner

prkumar commented Dec 28, 2018

The ratelimit decorator should be available in v0.8.0. After I merge #132, I'll create a new alpha release v0.8.0a1 in case you wan't to try it out before the official release. To install this alpha release with pip, do:

$ pip install --pre uplink

Here's some documentation for the decorator. (I'll also be soon adding a section to the quickstart about this feature). Notably, this decorator can be used like the other decorators, such as @timeout or @headers:

class GitHub(uplink.Consumer):
    @uplink.ratelimit(calls=15, period=900)  # limit of 15 calls every 15 minutes
    @uplink.get("/users/{user}")
    def get_user(self, user):
        pass

If you get the chance to try it out, let me know if you also have any feedback!

CC: @codylandry

@prkumar
Copy link
Owner

prkumar commented Dec 30, 2018

I just released an new alpha version, v0.8.0a2, with some updates to this decorator. If you were testing the previous alpha, please update:

$ pip install --pre -U uplink

Also, I've added a section to the quickstart to help get started with using this decorator: https://uplink.readthedocs.io/en/latest/user/quickstart.html#client-side-rate-limiting

CC: @codylandry

@prkumar prkumar closed this as completed Feb 21, 2019
@prkumar prkumar unpinned this issue Feb 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants