SocketSwap
SocketSwap is a python package that allows to proxy any third-party libraries traffic through a local TCP Proxy
What it is and what it does
SocketSwap is a Python proxy wrapper that intercepts socket connections from third-party libraries and routes them through a local TCP SOCKS5 proxy. It solves the problem of adding proxy support to libraries that don't natively provide it—useful when you need to tunnel traffic through a corporate proxy, VPN, or other intermediary without modifying the library code itself.
The package offers two usage modes: a context manager that runs the proxy in a daemon process, or a direct blocking script. It has no runtime dependencies and installs cleanly. However, it is dormant—the last release was 2023-09-29 and the last commit 2024-01-15—so it receives no active maintenance, and the repository has minimal adoption (2 stars).
Use it for:
- Proxy database client connections (e.g., psycopg2, pymongo) through a corporate firewall or VPN.
- Route third-party library HTTP/HTTPS traffic through a SOCKS5 proxy without modifying library code.
- Test applications behind a proxy by intercepting and redirecting socket connections in a test harness.
- Tunnel non-Python native libraries' network traffic through a proxy in mixed-language environments.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
SocketSwap intercepts and redirects network traffic from third-party Python libraries through a local TCP SOCKS5 proxy, enabling proxy support for libraries that don't natively provide it.
Yes, if you have a specific need to proxy a library that lacks native proxy support and you accept the maintenance risk. The package is simple, has no dependencies, and carries a permissive license. However, dormancy (last update 2024-01-15, only 2 stars) means you should verify it works with your target library and Python version before relying on it in production, and be prepared to fork or patch it if issues arise.
Install
socketswap on PyPI
pip
pip install socketswapuv
uv add socketswappoetry
poetry add socketswapInstalling SocketSwap
Before you install
Installation is straightforward with no runtime dependencies. The package is dormant—last updated 2024-01-15 with only 2 repository stars—so expect no active maintenance or bug fixes.
License in practice
MIT license is permissive; you can use, modify, and distribute SocketSwap freely in commercial or private projects with minimal restrictions.
Quickstart
from SocketSwap import ProxySwapContext
import socket
def socket_factory():
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(("localhost", 5432))
return s
with ProxySwapContext(socket_factory, "127.0.0.1", 2222):
# traffic now proxied through 127.0.0.1:2222
pass
Requires a working SOCKS5 proxy server already running and accessible at the address you specify.
Verify before relying
- Whether the package works reliably with modern Python versions beyond 3.5, given classifiers list only 3.4 and 3.5.
- Whether the package handles concurrent connections or is limited to single-threaded use.
- Real-world stability and edge-case handling given the minimal repository activity and low star count.
Package facts
| License | MIT (permissive) |
| Python support | not specified |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | none |
| Maintenance | dormant — 1,050 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 468,812/month — #6,491 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: SocketSwap-0.1.11-py2.py3-none-any.whl
Tags
More Networking packages
h11 is a pure-Python HTTP/1.1 protocol…
permissive · top 100 on PyPI
psutilpsutil retrieves real-time information about…
permissive · top 1,000 on PyPI
pyOpenSSLpyOpenSSL wraps OpenSSL's SSL/TLS functionality…
permissive · top 1,000 on PyPI
uvloopuvloop is a drop-in replacement for Python's…
permissive · top 1,000 on PyPI
execnetexecnet lets you spawn and communicate with…
permissive · top 1,000 on PyPI
pyzmqPyZMQ provides Python bindings for ZeroMQ…
permissive · top 1,000 on PyPI
hass-web-proxy-libProvides base classes and utilities for Home…
permissive · top 15,000 on PyPI
PySocksPySocks provides a SOCKS and HTTP proxy client…
permissive · top 1,000 on PyPI
mitmproxy-windowsProvides Windows-specific traffic redirection…
copyleft · top 15,000 on PyPI
pproxypproxy is an asynchronous proxy server that…
permissive · top 15,000 on PyPI
asysocksAsynchronous SOCKS5, SOCKS4, and HTTP proxy…
permissive · top 15,000 on PyPI
googlenewsdecoderDecodes Google News redirect URLs to their…
permissive · top 15,000 on PyPI
python-socksProvides SOCKS4(a), SOCKS5(h), and HTTP CONNECT…
permissive · top 5,000 on PyPI
httpx-socksAdds SOCKS4(a), SOCKS5(h), and HTTP CONNECT…
permissive · top 5,000 on PyPI
aiohttp_socksProvides a proxy connector for aiohttp that…
permissive · top 5,000 on PyPI
websockifyTranslates WebSocket connections to normal TCP…
copyleft · top 15,000 on PyPI