]> git.ipfire.org Git - thirdparty/httpx.git/commitdiff
Add Unix Domain Sockets section to advanced docs page (#542)
authorJonas Lundberg <jonas@5monkeys.se>
Wed, 20 Nov 2019 07:48:58 +0000 (08:48 +0100)
committerFlorimond Manca <florimond.manca@gmail.com>
Wed, 20 Nov 2019 07:48:58 +0000 (08:48 +0100)
docs/advanced.md

index 3e73f5b57394bdf327a973502d43430925228677..1365645d4d7c9c5e83b047a171a09d9c89a684e1 100644 (file)
@@ -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.