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

Add HTTPTransport and AsyncHTTPTransport #1399

Merged
merged 15 commits into from
Jan 8, 2021
Merged

Add HTTPTransport and AsyncHTTPTransport #1399

merged 15 commits into from
Jan 8, 2021

Conversation

tomchristie
Copy link
Member

Closes #1302

Two points to note here...

  1. I've not added corresponding proxy cases here. We've got two options there...
  • Add httpx.ProxyTransport() / httpx.AsyncProxyTransport() classes.
  • Add a proxy argument to the existing class. Switch which httpcore instance is used for ._pool depending on that argument. httpx.HTTPTransport(proxy=...), httpx.AsyncHTTPTransport(proxy=...). I think I quite like the way that'd have a lower footprint.
  1. I've currently used open-ended kwargs for the advanced options. I'm kinda thinking to switch these out to named uds, local_address, etc... options instead, although kwargs does at least have the benefit of allowing us to add options to httpcore and have them be exposed without any changes in httpx.

Copy link
Member

@florimondmanca florimondmanca left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good! Is it expecting that keepalive changes are also in here, though?

docs/async.md Outdated Show resolved Hide resolved
httpx/_transports/default.py Show resolved Hide resolved
httpx/_transports/default.py Outdated Show resolved Hide resolved
@florimondmanca florimondmanca added the enhancement New feature or request label Nov 30, 2020
@tomchristie tomchristie mentioned this pull request Nov 30, 2020
3 tasks
@florimondmanca florimondmanca added this to the v0.17 milestone Nov 30, 2020
@tomchristie
Copy link
Member Author

@florimondmanca Okay, so...

I've gone for explicit arguments throughout. (Maxim of: Of two otherwise equally valid design options, choose the more constrained) Note that it highlights the fact that uds, local_address, and retries aren't currently supported by the proxy cases. Perhaps some of them should or not, unsure, but we should discuss that separately either way - we're not backtracking on anything here, just making it more obviously apparent.

I've also added the proxy=... argument directly here. It ends up rather neat, and is the most minimal increase the API surface area, so I reckon we ought to roll with that.

Copy link
Member

@florimondmanca florimondmanca left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, this is looking neat. 👍

@tomchristie tomchristie merged commit 89fb0cb into master Jan 8, 2021
@tomchristie tomchristie deleted the httptransport branch January 8, 2021 10:23
@remingtonc
Copy link

This is an exciting addition - any idea when it will be released?

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
None yet
Development

Successfully merging this pull request may close these issues.

Add httpx.HTTPTransport() and httpx.AsyncHTTPTransport()
3 participants