Skip to content

Add HTTPTransport and AsyncHTTPTransport - #1399

Merged
lovelydinosaur merged 15 commits into
masterfrom
httptransport
Jan 8, 2021
Merged

Add HTTPTransport and AsyncHTTPTransport#1399
lovelydinosaur merged 15 commits into
masterfrom
httptransport

Conversation

@lovelydinosaur

Copy link
Copy Markdown
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.

@florimondmancaflorimondmanca left a comment

Copy link
Copy Markdown
Contributor

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?

Comment threaddocs/async.md Outdated
Comment threadhttpx/_transports/default.py
Comment threadhttpx/_transports/default.py Outdated
@florimondmancaflorimondmanca added the enhancement New feature or request label Nov 30, 2020
@lovelydinosaurlovelydinosaur mentioned this pull request Nov 30, 2020
3 tasks
@florimondmancaflorimondmanca added this to the v0.17 milestone Nov 30, 2020
Comment threadhttpx/_transports/default.py Outdated
@lovelydinosaur

Copy link
Copy Markdown
MemberAuthor

@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.

@florimondmancaflorimondmanca left a comment

Copy link
Copy Markdown
Contributor

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. 👍

@lovelydinosaur
lovelydinosaur merged commit 89fb0cb into masterJan 8, 2021
@lovelydinosaur
lovelydinosaur deleted the httptransport branch January 8, 2021 10:23
@remingtonc

Copy link
Copy Markdown

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

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancementNew feature or request

Development

Successfully merging this pull request may close these issues.

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

3 participants

@lovelydinosaur@remingtonc@florimondmanca