skillfed

SocketSwap

SocketSwap is a python package that allows to proxy any third-party libraries traffic through a local TCP Proxy

socketswap v0.1.11 468.8K downloads/30d#6,491 on PyPI2
Permissive license MIT DORMANT released

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 socketswap

uv

uv add socketswap

poetry

poetry add socketswap

Installing 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

Development Status :: 5 - Production/StableIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseOperating System :: POSIX :: LinuxProgramming Language :: Python :: 3Programming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.4Programming Language :: Python :: 3.5

Tags

python socks5 proxy wrapperredirect library traffic through proxytcp proxy for python librariesnetwork traffic interceptionsocks5 proxy context managerlibrary traffic redirectionproxy socket wrapper
proxy-wrappersocks5socket-interception

More Networking packages