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.8
  • httpx>=0.28.0,<0.29.0
  • python-socks>=2.4.3,<3.0.0
  • trio>=0.24 (optional)
  • anyio>=3.3.4,<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 (aka "HTTPS proxies", experimental feature, both sync and async support)

import ssl
import httpx
from httpx_socks import AsyncProxyTransport

async def fetch(url):
    proxy_ssl = ssl.SSLContext(ssl.PROTOCOL_TLS)
    proxy_ssl.verify_mode = ssl.CERT_REQUIRED
    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

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

httpx_socks-0.13.0.tar.gz (120.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

httpx_socks-0.13.0-py3-none-any.whl (13.7 kB view details)

Uploaded Python 3

File details

Details for the file httpx_socks-0.13.0.tar.gz.

File metadata

  • Download URL: httpx_socks-0.13.0.tar.gz
  • Upload date:
  • Size: 120.9 kB
  • Tags: Source
  • Uploaded using 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}

File hashes

Hashes for httpx_socks-0.13.0.tar.gz
Algorithm Hash digest
SHA256 de4fd454dc95612e484e61f68229c1c0366a54b1a4ba6474cdfae8cb64820831
MD5 02ced5a07ae3ef5cd4acf85eb324cfb6
BLAKE2b-256 e01f93ec5f88543f9b2466c8940603bd0cb7472d8d7ceab7332e527fed8a5504

See more details on using hashes here.

File details

Details for the file httpx_socks-0.13.0-py3-none-any.whl.

File metadata

  • Download URL: httpx_socks-0.13.0-py3-none-any.whl
  • Upload date:
  • Size: 13.7 kB
  • Tags: Python 3
  • Uploaded using 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}

File hashes

Hashes for httpx_socks-0.13.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7419783d922e8172dd7742093d6cc32f9796025d9b3dec062696215f726d3124
MD5 60301487b15f49b447057fce2172cbac
BLAKE2b-256 a7b32c2d7d6845f7519cfd8e2d9ee578bc0a92f97d1f087c5ed271884d165d7e

See more details on using hashes here.

Release history Release notifications | RSS feed

0.13.1

2 files

This release

0.13.0 This release

2 files

0.12.0

2 files

0.11.0

2 files

0.10.1

2 files

0.10.0

2 files

0.9.2

2 files

0.9.1

2 files

0.9.0

2 files

0.8.1

2 files

0.8.0

2 files

0.7.8

2 files

0.7.7

2 files

0.7.6

2 files

0.7.5

2 files

0.7.4

2 files

0.7.3

2 files

0.7.2

2 files

0.7.1

2 files

0.7.0

2 files

0.6.0

2 files

0.5.2

2 files

0.5.1

2 files

0.5.0

2 files

0.4.1

2 files

0.4.0

2 files

0.3.1

2 files

0.3.0

2 files

0.2.10

2 files

0.2.9

2 files

0.2.8

2 files

0.2.7

2 files

0.2.6

2 files

0.2.5

2 files

0.2.4

2 files

0.2.3

2 files

0.2.2

2 files

0.2.1

2 files

0.2.0

2 files

0.1.1

2 files

0.1.0

2 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