requests-unixsocket
Use requests to talk HTTP via a UNIX domain socket
What it is and what it does
requests-unixsocket is a thin adapter that teaches the requests library to speak HTTP over UNIX domain sockets instead of TCP. It works by registering a custom transport adapter that intercepts http+unix:// URLs and routes them through a local socket connection. The package is primarily used to interact with services that expose APIs only via socket files—most commonly Docker's daemon socket, but also other containerization and system management tools that follow this pattern.
You can use it two ways: by instantiating a special Session object and calling methods on it, or by monkeypatching the requests module globally (or within a context manager) to make standard requests.get() calls work with socket URLs. The package supports both standard UNIX sockets and Linux abstract namespace sockets, and it requires only requests as a runtime dependency.
Use it for:
- Query Docker daemon API by connecting to /var/run/docker.sock without spawning a subprocess
- Communicate with systemd user services or other system daemons that expose HTTP APIs via socket files
- Build container orchestration tools that need direct socket-level access to container runtimes
- Test HTTP services running locally that only listen on UNIX sockets in development environments
- Interact with Kubernetes kubelet or other Kubernetes components via their socket endpoints
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Extends the requests library to make HTTP calls over UNIX domain sockets instead of TCP, enabling communication with local socket-based services like Docker.
Yes, if you need to make HTTP requests to services listening on UNIX domain sockets. The package is lightweight, actively maintained, has no known vulnerabilities, and integrates seamlessly with the familiar requests API. The main caveat is that license treatment is unclear in the metadata, so verify the actual license in the repository before use in proprietary code.
Install
requests-unixsocket on PyPI
pip
pip install requests-unixsocketuv
uv add requests-unixsocketpoetry
poetry add requests-unixsocketInstalling requests-unixsocket
Before you install
Low friction install with a single runtime dependency on requests. The package is actively maintained with recent commits and has been stable since its early releases.
Quickstart
import requests_unixsocket
session = requests_unixsocket.Session()
r = session.get('http+unix://%2Fvar%2Frun%2Fdocker.sock/info')
print(r.json())
Requires Python 3.9 or later. UNIX domain socket support is OS-dependent; abstract namespace sockets are Linux-only.
Verify before relying
- Whether the package handles connection pooling and performance characteristics for high-volume socket communication
- Support status for Windows named pipes or other non-UNIX socket transports
Package facts
| License | not declared (unclear) |
| Python support | supports the current Python release (>=3.9) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 1 — requests |
| Maintenance | actively maintained — 525 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 2,927,288/month — #2,822 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: requests_unixsocket-0.4.1-py3-none-any.whl
Tags
More WWW/HTTP packages
urllib3 is an HTTP client library that provides…
permissive · top 100 on PyPI
requestsRequests is a Python HTTP library that…
permissive · top 100 on PyPI
h11h11 is a pure-Python HTTP/1.1 protocol…
permissive · top 100 on PyPI
httpxHTTPX is a fully featured HTTP client library…
permissive · top 100 on PyPI
httpcoreA minimal low-level HTTP client library that…
permissive · top 100 on PyPI
aiohttpaiohttp is an async HTTP client and server…
permissive · top 100 on PyPI
manholeManhole installs an in-process debugging…
permissive · top 5,000 on PyPI
requests-unixsocket2Extends the requests library to make HTTP calls…
permissive · top 15,000 on PyPI
requests-ntlm3Provides HTTP NTLM authentication for the…
permissive · top 15,000 on PyPI
httpx-socksAdds SOCKS4(a), SOCKS5(h), and HTTP CONNECT…
permissive · top 5,000 on PyPI
requests-ntlm2Adds NTLM authentication support to the…
permissive · top 15,000 on PyPI
PySocksPySocks provides a SOCKS and HTTP proxy client…
permissive · top 1,000 on PyPI
requests-mockIntercepts and mocks HTTP requests made through…
permissive · top 1,000 on PyPI
pymemcacheA pure-Python memcached client implementing the…
permissive · top 5,000 on PyPI
pytest-socketA pytest plugin that blocks or restricts socket…
permissive · top 5,000 on PyPI