requests-unixsocket2
Use requests to talk HTTP via a UNIX domain socket
What it is and what it does
requests-unixsocket2 is a thin adapter that teaches the requests HTTP library to communicate over UNIX domain sockets instead of TCP connections. This is useful for talking to services that listen on local sockets—like the Docker daemon on /var/run/docker.sock—without needing a separate HTTP client library or lower-level socket code.
You can use it two ways: instantiate a special Session object and call methods on it, or monkeypatch the requests module globally (or temporarily via context manager) to make standard requests.get() and similar calls work with socket URLs. It supports both regular UNIX sockets and Linux abstract namespace sockets (prefixed with a NULL byte). The package depends only on requests and urllib3, so installation is straightforward.
Use it for:
- Query the Docker daemon API by connecting to /var/run/docker.sock without spawning a subprocess
- Communicate with system services that expose HTTP-like APIs over UNIX sockets
- Build tools that interact with local socket-based services while reusing existing requests-based code
- Test HTTP clients against mock services listening on abstract namespace sockets in CI/CD pipelines
- Avoid network overhead and port conflicts by using UNIX sockets for inter-process HTTP communication
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, supporting both explicit session objects and monkeypatching for minimal code changes.
Yes, if you need to make HTTP requests to services listening on UNIX domain sockets (Docker, systemd, etc.) and want to reuse the familiar requests API. The low install friction and permissive license make it a straightforward choice. The aging maintenance status is not a blocker for this narrow, stable use case, but verify that the fork's divergence from the original project meets your needs.
Install
requests-unixsocket2 on PyPI
pip
pip install requests-unixsocket2uv
uv add requests-unixsocket2poetry
poetry add requests-unixsocket2Installing requests-unixsocket2
Before you install
Low friction installation with only requests and urllib3 as runtime dependencies. Marked as aging (345 days since last release), so maintenance activity is limited but the package remains functional for its narrow use case.
License in practice
ISC license is permissive and imposes minimal restrictions; you can use, modify, and distribute this package freely in commercial and private projects.
Quickstart
pip install requests-unixsocket2
import requests_unixsocket
session = requests_unixsocket.Session()
r = session.get('http+unix://%2Fvar%2Frun%2Fdocker.sock/info')
print(r.status_code)
Requires Python >=3.9
Verify before relying
- Whether abstract namespace socket support (Linux-only feature) works reliably across different kernel versions
- Current state of the upstream origin project and how this fork diverges from it
Package facts
| License | ISC (permissive) |
| Python support | supports the current Python release (>=3.9) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 2 — requests, urllib3 |
| Maintenance | aging — 345 days since the last release |
| First released | |
| Downloads | 513,354/month — #6,247 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: requests_unixsocket2-1.0.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
requests-unixsocketExtends the requests library to make HTTP calls…
unclear · top 5,000 on PyPI
manholeManhole installs an in-process debugging…
permissive · top 5,000 on PyPI
requests-ntlm2Adds NTLM authentication support to the…
permissive · top 15,000 on PyPI
requests-ntlm3Provides HTTP NTLM authentication for the…
permissive · top 15,000 on PyPI
PySocksPySocks provides a SOCKS and HTTP proxy client…
permissive · top 1,000 on PyPI
httpieHTTPie is a command-line HTTP client that makes…
permissive · top 5,000 on PyPI
requests-mockIntercepts and mocks HTTP requests made through…
permissive · top 1,000 on PyPI
httpx-socksAdds SOCKS4(a), SOCKS5(h), and HTTP CONNECT…
permissive · top 5,000 on PyPI
hyper-upHTTP/2 client library for Python that provides…
permissive · top 15,000 on PyPI