skillfed

requests-unixsocket

Use requests to talk HTTP via a UNIX domain socket

requests-unixsocket v0.4.1 2.9M downloads/30d#2,822 on PyPI221
License unclear Active released

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-unixsocket

uv

uv add requests-unixsocket

poetry

poetry add requests-unixsocket

Installing 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

Development Status :: 3 - AlphaIntended Audience :: DevelopersIntended Audience :: Information TechnologyOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.9Programming Language :: Python :: ImplementationProgramming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: JythonProgramming Language :: Python :: Implementation :: PyPy

Tags

unix domain socket http clientrequests over unix socketdocker socket communicationlocal socket http requestsunix socket adapter requestshttp via unix domain socket
unix-socketdocker-clienthttp-adapter

More WWW/HTTP packages