-
-
Notifications
You must be signed in to change notification settings - Fork 811
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
Revamp docs on Client instances #836
Conversation
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.
This is great, thanks @florimondmanca!
I think it all reads quite well just left a comment to improve the conciseness of a section. 👍
docs/advanced.md
Outdated
|
||
Indeed, when using the top-level API, an HTTP connection has to be opened and closed _for every single request_. | ||
|
||
So, if you are making 50 HTTP/1.1 requests per second to a host using the top-level API, then HTTPX needs to open and shutdown 50 connections per second. This is a lot of work! It can quickly become expensive, and slow down your programs. Reasons include higher latency due to handshaking, higher CPU usage due to repeated TLS handshakes, higher network congestion due to a higher number of TCP connections, etc. |
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.
I would use this paragraph in place of the above benefits and maybe use bulletpoints in the reasons.
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.
Yes, the bullets and the "Reasons include" here do essentially repeat the same thing, so +1 to keeping just one of them, and using bullets.
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.
Thanks! I gave this section a different wording altogether to reduce the repetition. Let me know what you think!
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.
Some minor typo and consistency suggestions
Co-Authored-By: Hugo van Kemenade <hugovk@users.noreply.github.com>
Co-Authored-By: Hugo van Kemenade <hugovk@users.noreply.github.com>
Merging now, thanks both for the reviews! 👍 |
Ace, great work! |
This PR updates the documentation on
Client
instances:.close()
-style usage..build_request()
to more generally detail how to use explicitRequest
instances (can be linked to in Add docs on request instances to Requests compatibility guide #823 once this is merged).