{"id":21443,"library":"httpx-socks","title":"httpx-socks","description":"Provides proxy transports (HTTP, SOCKS4, SOCKS5) for httpx, enabling proxy support for both sync and async httpx clients. Currently at version 0.11.0, released with support for Python >=3.8. The library wraps httpx transports using PySocks and optionally trio for async. Releases are infrequent, with the last update in 2024.","status":"active","version":"0.11.0","language":"python","source_language":"en","source_url":"https://github.com/romis2012/httpx-socks","tags":["httpx","proxy","socks","socks5","socks4","http-proxy","transport"],"install":[{"cmd":"pip install httpx-socks","lang":"bash","label":"Install httpx-socks"}],"dependencies":[{"reason":"Core dependency; httpx is needed to use the transports.","package":"httpx","optional":false},{"reason":"Required for SOCKS proxy support.","package":"PySocks","optional":false}],"imports":[{"note":"","wrong":"","symbol":"SyncProxyTransport","correct":"from httpx_socks import SyncProxyTransport"},{"note":"","wrong":"","symbol":"AsyncProxyTransport","correct":"from httpx_socks import AsyncProxyTransport"}],"quickstart":{"code":"import httpx\nfrom httpx_socks import SyncProxyTransport\n\ntransport = SyncProxyTransport.from_url('socks5://user:pass@proxy.example.com:1080')\n\nwith httpx.Client(transport=transport) as client:\n    response = client.get('http://httpbin.org/ip')\n    print(response.json())","lang":"python","description":"Create a sync httpx client with SOCKS5 proxy authentication."},"warnings":[{"fix":"Always use `SyncProxyTransport` for sync clients and `AsyncProxyTransport` for async clients.","message":"`SyncProxyTransport` and `AsyncProxyTransport` are the only supported transports. Do NOT import `ProxyTransport` directly as it is an internal class.","severity":"gotcha","affected_versions":"all"},{"fix":"Use `SyncProxyTransport.from_url(url)` or `AsyncProxyTransport.from_url(url)`.","message":"The `from_url` class method is the only recommended way to create a transport. Directly instantiating transports with `proxy_type`, etc., may be removed in future versions.","severity":"deprecated","affected_versions":"0.10.0+"},{"fix":"Upgrade both to latest: `pip install -U httpx httpx-socks`","message":"As of httpx 0.28.0, the transport interface changed, and older versions of httpx-socks may break. Ensure httpx and httpx-socks versions are compatible (e.g., httpx>=0.28 with httpx-socks 0.11+).","severity":"breaking","affected_versions":"httpx>=0.28"},{"fix":"Include credentials in the URL: `socks5://username:password@host:port`","message":"Proxy authentication for SOCKS5 requires `user:pass` in the URL. Without 'user:pass' in the URL, the transport will not authenticate even if the proxy expects it.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Run `pip install httpx-socks` in the correct Python environment.","cause":"The package is not installed or installed in an incorrect environment.","error":"ModuleNotFoundError: No module named 'httpx_socks'"},{"fix":"Use `from httpx_socks import SyncProxyTransport` or `AsyncProxyTransport`.","cause":"Attempting to import the internal class `ProxyTransport` directly.","error":"AttributeError: module 'httpx_socks' has no attribute 'ProxyTransport'"},{"fix":"Pass the proxy URL as the first positional argument: `...from_url('socks5://...')`","cause":"Trying to pass kwargs that are not expected in `from_url`. The method accepts a URL string only.","error":"TypeError: SyncProxyTransport.from_url() got an unexpected keyword argument 'proxy_type'"},{"fix":"Verify the proxy hostname and check network connectivity.","cause":"The proxy hostname in the URL cannot be resolved (DNS failure).","error":"httpx.ConnectError: [Errno -2] Name or service not known"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}