skillfed

requests-unixsocket2

Use requests to talk HTTP via a UNIX domain socket

requests-unixsocket2 v1.0.1 513.4K downloads/30d#6,247 on PyPI
Permissive license ISC AGING released

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

uv

uv add requests-unixsocket2

poetry

poetry add requests-unixsocket2

Installing 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

Intended Audience :: DevelopersIntended Audience :: Information TechnologyLicense :: OSI Approved :: ISC License (ISCL)Operating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3

Tags

http over unix socketrequests unix domain socketunix socket http clientdocker socket communicationlocal socket http requestsabstract namespace socketunix socket adapter requests
unix-socketdocker-clientsystem-integration

More WWW/HTTP packages