Skip to main content

An httpx transport powered by pycurl

Project description

httpx-pycurl

httpx-pycurl provides an httpx transport that executes requests with pycurl. It combines the goodness of curl with the familiar httpx API, including support for http/2 and even non-http protocols built into curl. On my machine, AsyncPyCurlTransport performs better than httpx's default AsyncHttpTransport, taking approximately 75% of the time to fetch 60 files from a local nginx test server.

httpx-pycurl is in early development, started from an LLM-written draft implementation.

Install

pip install httpx-pycurl

Or with conda,

conda install -n base conda-pypi
conda pypi install httpx-pycurl

Usage

AsyncPyCurlTransport is the focus of this package. It uses the curl multi_socket interface to integrate curl with the asyncio event loop.

import httpx
from httpx_pycurl import AsyncPyCurlTransport

transport = AsyncPyCurlTransport(timeout=10.0)

async with httpx.AsyncClient(transport=transport) as client:
    responses = await asyncio.gather(*(client.get(url) for url in urls))

AsyncPyCurlTransport delegates SSL/TLS handling to curl and does not use Python's builtin ssl module. By default it calls certifi.where() to set root certificates. It is also possible to pass a custom path to the root certificates with AsyncPyCurlTransport(cainfo=ca_cert_path).

PyCurlTransport is not the focus of this project and is less likely to work. In the future it may delegate to AsyncPyCurlTransport.

import httpx
from httpx_pycurl import PyCurlTransport

transport = PyCurlTransport(timeout=10.0)

with httpx.Client(transport=transport) as client:
    response = client.get("https://example.com")
    print(response.status_code)
    print(response.text)

debug_transport = PyCurlTransport(
    verbose=True,
    debug_callback=lambda info_type, data: print(info_type, data),
)

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_pycurl-0.0.1.tar.gz (13.6 kB view details)

Uploaded Source

Built Distribution

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

httpx_pycurl-0.0.1-py3-none-any.whl (7.3 kB view details)

Uploaded Python 3

File details

Details for the file httpx_pycurl-0.0.1.tar.gz.

File metadata

  • Download URL: httpx_pycurl-0.0.1.tar.gz
  • Upload date:
  • Size: 13.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for httpx_pycurl-0.0.1.tar.gz
Algorithm Hash digest
SHA256 1204757404963f42a6ea41b3fc99129bfbb16531926130af6726b90b66ea51c7
MD5 243346c44fca380a609c9bb5644d4bab
BLAKE2b-256 c43dae1cc70c254ac81d698e620820014a5a264ad0a3bb2976b177671fb6a050

See more details on using hashes here.

Provenance

The following attestation bundles were made for httpx_pycurl-0.0.1.tar.gz:

Publisher: pypi.yml on dholth/httpx-pycurl

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file httpx_pycurl-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: httpx_pycurl-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 7.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for httpx_pycurl-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 43a7f8fe8653bf2dadc51b2690303f712a9189503358cbee16aab6f6aa7a77ac
MD5 06738617dabdc06bbb9a36fcb70626b1
BLAKE2b-256 6258fc2b0da3a1c7cfe30e0d1ad23fc7407ed739271821373efe3d6846717822

See more details on using hashes here.

Provenance

The following attestation bundles were made for httpx_pycurl-0.0.1-py3-none-any.whl:

Publisher: pypi.yml on dholth/httpx-pycurl

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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