-
-
Notifications
You must be signed in to change notification settings - Fork 22
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
Specialize rate limiting errors #11
Comments
Apologies if I'm misunderstanding ... or just wrong. 😳 😬 It looks like this has since changed (in https://developers.strava.com/docs/#rate-limiting) so that Instead of only returning the body, would it be possible to also include the limit and usage values? Something like this?
I can't increase the size of the 🤷♂ I'd like to attach to this suggestion/question. 😄 There are probably better ways to go about this, but I was trying to think of a way to start the conversation with the least-breaking change. 🤔 |
This issue is about raising a Returning rate limiting information as part of every response now that it's available would be a different work-item. What's the scenario in which you want to use that information on a successful response? I definitely don't think we should be moving data from headers to the body of the response, however I think it should be OK to refactor the library such as instead of returning body the entire response is returned and the response is available in its raw form from every object constructed from the response, maybe something like: activity = client.activity(1982980795)
activity.name # => 'Afternoon Run'
activity._request # http request
activity._response # http response I would wrap Response into a new class and instead of reaching into |
Ah, yeah, I can see how raising on rate limit vs returning rate limit info are two separate pieces of work. 👍 My use case on having access to these two values is to keep myself under the limit & to have a sense of where I stand. |
Looking forward to some PRs :) |
|
@simonneutert This should be fairly easy on top of #40 now, WDYT? |
I skimmed the Readme and the section Error would provide all info for what's needed to a proper client-side evaluation of the Error/Fault. The header contains data about ratelimits already and we documented it, every project using this would need custom code to react to errors anyways. Digging the header hash, will allow for the precise identification. And rereading through the issue, the reporter wanted to be able to check rate limits at any point in time and #40 (#64) does. We can definitely add a specific error, too, but I wanted to bring this to discussion first ✌️ @dblock |
@simonneutert This is about being able to |
* fixes #11 * moves RatelimitError into namespace of other errors * adds docs
* fixes dblock#11 * moves RatelimitError into namespace of other errors * adds docs
See https://developers.strava.com/docs/#client-code
Strava can respond with a rate limit error providing the time when the next request can be made.
The text was updated successfully, but these errors were encountered: