-
Notifications
You must be signed in to change notification settings - Fork 187
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
refactor: HTTPClient Re-Core #1057
Conversation
Signed-off-by: Alex Schoenhofen <alexanderschoenhofen@gmail.com>
… raising errors instead. Signed-off-by: Alex Schoenhofen <alexanderschoenhofen@gmail.com>
# Conflicts: # nextcord/http.py
I demand a rename of the title |
oh shoot I knew I forgot something |
…ting, adds RateLimits erroring if a bucket update unintended for them is given, now resets the bucket reset timer when pessimistic RateLimit.reset_after is updated, fixes edge cases where the RateLimit reset timer is never started, adds and changes logging messages, *_url_rate_limit() and *_url_deny() methods now take Route instead of path, improved behavior of bucket changes when using asyncio.gather(). Signed-off-by: Alex Schoenhofen <alexanderschoenhofen@gmail.com>
…eLimit docstring, cleans up (Global)RateLimit checking if the global ratelimit was hit. Signed-off-by: Alex Schoenhofen <alexanderschoenhofen@gmail.com>
Regardless I also think that kind of information is too high level / frequent for |
…ct most of token in logging when possible. Signed-off-by: Alex Schoenhofen <alexanderschoenhofen@gmail.com>
… of token when possible. Signed-off-by: Alex Schoenhofen <alexanderschoenhofen@gmail.com>
…mit time offsets, readds dispatching http_ratelimit. Signed-off-by: Alex Schoenhofen <alexanderschoenhofen@gmail.com>
Signed-off-by: Alex Schoenhofen <alexanderschoenhofen@gmail.com>
Signed-off-by: Alex Schoenhofen <alexanderschoenhofen@gmail.com>
Signed-off-by: Alex Schoenhofen <alexanderschoenhofen@gmail.com>
Signed-off-by: Alex Schoenhofen <alexanderschoenhofen@gmail.com>
Signed-off-by: Alex <alex@darkkingdom.lan>
… to a private function Signed-off-by: Alex Schoenhofen <alexanderschoenhofen@gmail.com>
Signed-off-by: Alex Schoenhofen <alexanderschoenhofen@gmail.com>
Signed-off-by: Alex Schoenhofen <alexanderschoenhofen@gmail.com>
Signed-off-by: Alex Schoenhofen <alexanderschoenhofen@gmail.com>
Signed-off-by: Alex Schoenhofen <alexanderschoenhofen@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Few more suggestions left, sorry 😭
It's all documentation stuff at this point tho
Co-authored-by: Emre Terzioglu <50607143+EmreTech@users.noreply.github.com>
… docstring to a comment above, add real docstring Signed-off-by: Alex Schoenhofen <alexanderschoenhofen@gmail.com>
Signed-off-by: Alex Schoenhofen <alexanderschoenhofen@gmail.com>
Signed-off-by: Alex Schoenhofen <alexanderschoenhofen@gmail.com>
Signed-off-by: Alex Schoenhofen <alexanderschoenhofen@gmail.com>
outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested by others is good 👍, merging since 3.0 is in development anyway and this is a large change.
Summary
Massively reworks the core of HTTP, adding support for:
auth
kwarg, opening the way for OAuth2 extensions,retry_request
kwarg, allowing the user to disable auto-retries on ratelimit or Discord server errors.Due to restructuring, there HAS been some breaking changes.
MaybeUnlock
has been removed and replaced with a completely differentRateLimit
.HTTPClient.request()
will no longer overwrite specific provided headers, allowing you, for example, to override the auth and user-agent.HTTPClient
no longer being centered around a single token, theHTTPClient.token
attribute has been removed andClient._token
has been added.HTTPClient
may technically not be documented, almost all of its attributes were not_
'd, and thus were technically public. Since basically all of those attributes are gone/renamed, definitely a breaking change there,HTTPClient.static_login()
was modified to better fit with the rework ofHTTPClient
.Notes:
Webhook
andHTTPClient
had their own rate limiting implementations before this PR, and with this PR still do. To avoid more delays, migrating webhooks to useHTTPClient
is not in this PR.Checklist
task pyright
and fixed the relevant issues.