{"id":28195,"library":"PySocks","title":"PySocks","description":"PySocks is a core SOCKS client module that provides a socket wrapper supporting SOCKS4, SOCKS5, and HTTP proxy tunneling. The current version is 1.7.1. Releases are infrequent and focus on maintenance.","status":"active","version":"1.7.1","language":"python","source_language":"en","source_url":"https://github.com/Anorov/PySocks","tags":["socks","proxy","socket","network"],"install":[{"cmd":"pip install PySocks","lang":"bash","label":"Install from PyPI"}],"dependencies":[],"imports":[{"wrong":"import socks; socks.setdefaultproxy(socks.SOCKS5, 'host', port)","symbol":"socks","correct":"import socks"}],"quickstart":{"code":"import socks\nimport socket\n\nsocks.setdefaultproxy(socks.SOCKS5, 'localhost', 9050)\nsocket.socket = socks.socksocket\ns = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\ns.connect(('httpbin.org', 80))\ns.sendall(b'GET /ip HTTP/1.1\\r\\nHost: httpbin.org\\r\\n\\r\\n')\nprint(s.recv(4096).decode())\ns.close()","lang":"python","description":"Demonstrates monkey-patching socket to route all traffic through a SOCKS5 proxy."},"warnings":[{"fix":"Use socks.socksocket directly for individual sockets instead of setting socket.socket","message":"Monkey-patching socket.socket affects entire Python process; avoid in production or use per-connection approach.","severity":"gotcha","affected_versions":"all"},{"fix":"pip install PySocks and import socks; uninstall the stub package: pip uninstall socks","message":"The original 'socks' package on PyPI (version 0) is a stub that does nothing; use 'PySocks' instead.","severity":"deprecated","affected_versions":"any"},{"fix":"Use SOCKS5 proxy type if authentication is needed.","message":"PySocks does not support authentication for SOCKS4; only SOCKS5 supports username/password.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"search_vec":"'1.7.1':25 'client':7 'core':5 'current':22 'focus':30 'http':18 'infrequ':28 'mainten':32 'modul':8 'network':36 'provid':10 'proxi':19,34 'pysock':1,2 'releas':26 'sock':6,33 'socket':12,35 'socks4':15 'socks5':16 'support':14 'tunnel':20 'version':23 'wrapper':13","created_at":"2026-05-09T05:54:13.682066+00:00","updated_at":"2026-05-09T05:54:13.682066+00:00","problems":null,"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/Anorov/PySocks","docs":null,"changelog":null,"pypi":"https://pypi.org/project/PySocks/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["http-networking"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"passing","verified_at":"2026-07-03","last_verified":"2026-07-03","next_check":"2026-08-02","install_tag":null}}