Skip to content
Myr

Document Unix Domain Socket usage (#1186)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Florimond Manca · committed by GitHub · parent 09c3e90 · Browse files · 1 file+18 added−0 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+18 added−0 removed

  • other:+18 added−0 removed

1 file+18 added−0 removed

modified:docs/advanced.md+18 added
825 unmodified lines
826... ) # Use the standard HTTPX defaults, but with an IPv4 only 'local_address'.827>>> client = httpx.Client(transport=transport)828```829830Similarly, `httpcore` provides a `uds` option for connecting via a Unix Domain Socket that is only available via this low-level API:831832```python833>>> import httpx, httpcore834>>> ssl_context = httpx.create_ssl_context()835>>> transport = httpcore.SyncConnectionPool(836... ssl_context=ssl_context,837... max_connections=100,838... max_keepalive_connections=20,839... keepalive_expiry=5.0,840... uds="/var/run/docker.sock",841... ) # Connect to the Docker API via a Unix Socket.842>>> client = httpx.Client(transport=transport)843>>> response = client.get("http://docker/info")844>>> response.json()845{"ID": "...", "Containers": 4, "Images": 74, ...}846```847848Unlike the `httpx.Client()`, the lower-level `httpcore` transport instances849do not include any default values for configuring aspects such as the850connection pooling details, so you'll need to provide more explicit851configuration when using this API.
49 unmodified lines