Skip to main content

httpx-socks

CI Coverage Status PyPI version versions

The httpx-socks package provides proxy transports for httpx client. SOCKS4(a), SOCKS5(h), HTTP CONNECT proxy supported. It uses python-socks for core proxy functionality.

Requirements

  • Python >= 3.9
  • httpx>=0.28.0,<0.29.0
  • python-socks>=2.4.3,<3.0.0
  • trio>=0.30 (optional)
  • anyio>=4.12,<5.0.0 (optional)

Installation

only sync proxy support:

pip install httpx-socks

to include optional asyncio support (it requires async-timeout):

pip install httpx-socks[asyncio]

to include optional trio support:

pip install httpx-socks[trio]

Usage

sync transport

import httpx
from httpx_socks import SyncProxyTransport

def fetch(url):
    transport = SyncProxyTransport.from_url('socks5://user:password@127.0.0.1:1080')
    with httpx.Client(transport=transport) as client:
        res = client.get(url)
        return res.text

async transport (asyncio, trio)

import httpx
from httpx_socks import AsyncProxyTransport

async def fetch(url):
    transport = AsyncProxyTransport.from_url('socks5://user:password@127.0.0.1:1080')
    async with httpx.AsyncClient(transport=transport) as client:
        res = await client.get(url)
        return res.text

secure proxy connections (experimental feature, both sync and async support)

import ssl
import httpx
from httpx_socks import AsyncProxyTransport

async def fetch(url):
    proxy_ssl = ssl.create_default_context()
    proxy_ssl.load_verify_locations(...)
    
    transport = AsyncProxyTransport.from_url('http://user:password@127.0.0.1:8080', proxy_ssl=proxy_ssl)
    async with httpx.AsyncClient(transport=transport) as client:
        res = await client.get(url)
        return res.text

Metadata

Release files for httpx-socks 0.13.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for httpx-socks 0.13.1
File Size Uploaded
httpx_socks-0.13.1.tar.gz 120.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for httpx-socks 0.13.1
File Interpreter ABI Platform
httpx_socks-0.13.1-py3-none-any.whl Python 3 none any Details

Total release size: 134.7 kB

Release files / httpx_socks-0.13.1.tar.gz

Download URL httpx_socks-0.13.1.tar.gz
Size 120.9 kB
Tags Source
SHA-256 checksum
How to use checksums
9114898471eb0b2c1f67749f1d2b1c9d35c9f6c450d2f5c338033fc2d0af2d20
BLAKE2b-256 checksum
How to use checksums
2a8a1a36f6c3324d19c33e2b8a72222c609a950d271560a8198283c92dd808d5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.1 {"installer":{"name":"uv","version":"0.12.1","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / httpx_socks-0.13.1-py3-none-any.whl

Download URL httpx_socks-0.13.1-py3-none-any.whl
Size 13.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
771b4f3dbc8f62515a6f8a64f3e1dea9a7826a2521032351d3bd5cc008486bb6
BLAKE2b-256 checksum
How to use checksums
19642f64faa059e5f413de846aefd4e7c1db3273fb49a62e1e1767280f2d1d88
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.1 {"installer":{"name":"uv","version":"0.12.1","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release history Release notifications | RSS feed

This release

0.13.1 This release

2 release files

0.13.0

2 release files

0.12.0

2 release files

0.10.0

2 release files

0.9.2

2 release files

0.9.1

2 release files

0.9.0

2 release files

0.8.1

2 release files

0.8.0

2 release files

0.7.8

2 release files

0.7.7

2 release files

0.7.6

2 release files

0.7.5

2 release files

0.7.4

2 release files

0.7.3

2 release files

0.7.2

2 release files

0.7.1

2 release files

0.7.0

2 release files

0.6.0

2 release files

0.5.2

2 release files

0.5.1

2 release files

0.5.0

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.10

2 release files

0.2.9

2 release files

0.2.8

2 release files

0.2.7

2 release files

0.2.6

2 release files

0.2.5

2 release files

0.2.4

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page