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 default transport helpers #1431

Closed
wants to merge 4 commits into from
Closed

Conversation

florimondmanca
Copy link
Member

@florimondmanca florimondmanca commented Dec 18, 2020

Closes #1302

Alternative to #1399

Instead of adding new classes (HTTPTransport, AsyncHTTPTransport), we focus on the "provide defaults" part by providing "factory helpers", rather than wrapper classes. I think that might be lower-maintenance, but also it's more easily testable since we have a direct access to the HTTPCore default transport object.

Also contains unit tests, and an integration test for the "disable HTTP/2 on a single domain" use case.

  • I'm also on the fence wrt **kwargs versus explicit parameters. Perhaps the latter? — Switched to explicit params.
  • With this PR, it's clearer that for proxies we should definitely prefer a proxy=... parameter to create_default_transport(), that would switch between returning a connection pool or a proxy pool. But at the same time, it's not clear to me which use cases a proxy=... parameter would allow solving that's not already solvable through the proxies=... routing and the Proxy config class… Well, obviously there's customizing max_keepalive_connections and the like, but that's super-low-level, so… Leaving it out for now.

@florimondmanca florimondmanca added the enhancement New feature or request label Dec 18, 2020
@tomchristie
Copy link
Member

Interesting. 🤔

@tomchristie
Copy link
Member

From a little bit of thinking over...

My natural inclination here would be to prefer #1399 on the basis of consistency.

  • httpx.HTTPTransport
  • httpx.MockTransport
  • httpx.WSGITransport
  • httpx.ASGITransport

@florimondmanca
Copy link
Member Author

@tomchristie Yeah, upon reviewing again I'm actually on the same boat. :-)

@florimondmanca florimondmanca deleted the fm/default-transports branch January 6, 2021 12:36
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()
2 participants