-
Notifications
You must be signed in to change notification settings - Fork 18
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
Rate Limiting #4
Comments
My opinion: the SDK should handle rate limiting simply by raising an exception when the rate limit is exceeded. If we want to handle more complicated logic (e.g. automatically wait for rate limits to reset) then it should be part of a separate "batch operations" package built on top of the SDK, not hard-coded into it. (It's OK if this package ships with the SDK.) My arguments:
|
I think retrying function should be build in as an option. My thoughts on this come in two folds:
|
@natewalton I know you had been thinking about this problem - looping you in, in case you hadn't seen this issue |
I'm torn, on the one hand I agree with @pwsiegel that the SDK should just do the work of translating the API's response into something Python (e.g. JSON error message --> Exception) and stop there. It most clearly defines what the SDK should, and should not be for. But I also can't help but think that we'd save a lot of repetitive coding in SDK user's lives by providing options for built-in rate limiting. What I think justifies being in SDK itself is that rate limiting is a standard (and universal) component in API access much like the access token or any other parameter that we would manage on behalf of the user. It seems like there might be an elegant solution within the SDK, such as a nice decorator? What's the simplest way a user would code against rate limits working on the SDK from the outside? (my brain is tired so maybe this is obvious) Final thoughts would be that, first, we already have batch operations in the SDK that are combinations of API endpoints, so more complex batching then API rate limiting, and second, I would expect that multi-threaded applications wouldn't be any different a problem for in-SDK rate limiting since the rate limit won't rely on a exogenous counter and rather the JSON error response? Anyways FWIW! |
No description provided.
The text was updated successfully, but these errors were encountered: