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

HTTP headers for Rate Limits #48

Open
ghnp5 opened this issue Nov 24, 2022 · 1 comment
Open

HTTP headers for Rate Limits #48

ghnp5 opened this issue Nov 24, 2022 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@ghnp5
Copy link

ghnp5 commented Nov 24, 2022

Hey!

When making requests to the Twitter API, they return headers as described here:

https://developer.twitter.com/en/docs/twitter-api/rate-limits

Note that the HTTP headers are contextual. When using application-only authentication, they indicate the rate limit for the application context. When using user-based authentication, they indicate the rate limit for that user context.
x-rate-limit-limit: the rate limit ceiling for that given endpoint
x-rate-limit-remaining: the number of requests left for the 15-minute window
x-rate-limit-reset: the remaining window before the rate limit resets, in UTC epoch seconds

From what I understand, it's not possible to get these headers using BirdElephant, is that correct?

Thank you very much 😊

@ghnp5
Copy link
Author

ghnp5 commented Nov 25, 2022

I added a line to print $request->getHeaders() in Request.php, around line 110, and I see the headers there:

  ["x-rate-limit-limit"]=>900
  ["x-rate-limit-reset"]=>1669337889
  ["x-rate-limit-remaining"]=>899

It would definitely be useful to be able to access these, after we make a request to Twitter API :)
Saving them to some private field and then some function like ->getLastCallHeaders().

Another suggestion is to rename $request to $response, just to be clear that what's returned into that variable is a Response :)

@danieldevine danieldevine self-assigned this Nov 25, 2022
@danieldevine danieldevine added the enhancement New feature or request label Nov 25, 2022
@danieldevine danieldevine moved this to To do in Bird Elephant Nov 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: To do
Development

No branches or pull requests

2 participants