Skip to main content

Proxy (HTTP, SOCKS) transports for httpx

Project description

httpx-socks

Build Status Coverage Status PyPI version

Proxy transports for httpx client. SOCKS4(a), SOCKS5, HTTP (tunneling) proxy supported.

Requirements

  • Python >= 3.6
  • httpx >= 0.13.3
  • python-socks[asyncio,trio] >= 1.0.1

Installation

pip install httpx-socks

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 (both asyncio and trio supported)

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

Project details


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.2.8.tar.gz (7.5 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.2.8-py3-none-any.whl (8.7 kB view details)

Uploaded Python 3

File details

Details for the file httpx-socks-0.2.8.tar.gz.

File metadata

  • Download URL: httpx-socks-0.2.8.tar.gz
  • Upload date:
  • Size: 7.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/44.0.0.post20200106 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.7.6

File hashes

Hashes for httpx-socks-0.2.8.tar.gz
Algorithm Hash digest
SHA256 13109bec7c45ef8611672bf8f94343dfb93ee9b84fb9b62af1e43e0e367f4fed
MD5 93aa4439f8c66f77310f33893f1dcd7e
BLAKE2b-256 2acb6d1894615995b5928cf94e52733b8e6a6f6656ed8b711458b16434a34236

See more details on using hashes here.

File details

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

File metadata

  • Download URL: httpx_socks-0.2.8-py3-none-any.whl
  • Upload date:
  • Size: 8.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/44.0.0.post20200106 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.7.6

File hashes

Hashes for httpx_socks-0.2.8-py3-none-any.whl
Algorithm Hash digest
SHA256 b8262473b36a1f1268d52a2feaf8359ffaeec7acf69a9cea93733d0752465d45
MD5 5ade5664072f21efc3266d2e1abb5bf9
BLAKE2b-256 765f66a81b0d1fe75e76aae4cf444ca5b0efc3896cb4b3089872e3775dac579c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page