From: Jonas Lundberg Date: Wed, 20 Nov 2019 07:48:58 +0000 (+0100) Subject: Add Unix Domain Sockets section to advanced docs page (#542) X-Git-Tag: 0.8.0~7 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f0e6acb6e29770328b45d6b765fb035ac0a2bcbf;p=thirdparty%2Fhttpx.git Add Unix Domain Sockets section to advanced docs page (#542) --- diff --git a/docs/advanced.md b/docs/advanced.md index 3e73f5b5..1365645d 100644 --- a/docs/advanced.md +++ b/docs/advanced.md @@ -179,6 +179,21 @@ password example-password ... ``` +## Unix Domain Sockets + +You can configure an `httpx` client to connect through a unix domain socket via the `uds` parameter. This is useful when making requests to a server that is bound to a socket file rather than an IP address. + +Here's an example requesting the Docker Engine API: + +```python +import httpx + + +with httpx.Client(uds="/var/run/docker.sock") as client: + # This request will connect through the socket file. + resp = client.get("http://localhost/version") +``` + ## HTTP Proxying HTTPX supports setting up proxies the same way that Requests does via the `proxies` parameter.