httpx icon indicating copy to clipboard operation
httpx copied to clipboard

Add `httpx.Mounts` transport class.

Open lovelydinosaur opened this issue 1 year ago • 0 comments
trafficstars

Discussed in https://github.com/encode/httpx/issues/947#issuecomment-1881173378

This PR adds the Mounts and AsyncMounts transport classes.

Currently in draft... switch mounts=... out of the Client class directly.


Here's the synopsis...

We currently have mounts=... behaviour backed directly into the client, like so...

client = httpx.Client(mounts=...)

However it'd be neater to keep that complexity encapsulated within a transport class that supports routing, so...

transport = httpx.Mounts(...)
client = httpx.Client(transport=transport)

At this point in time the pull request replicates the mounts=... functionality in a transport class, but doesn't yet remove it from the client. A follow-up would deal with removing it.

lovelydinosaur avatar Jan 25 '24 07:01 lovelydinosaur