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.2.tar.gz (17.7 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.2-py3-none-any.whl (9.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: httpx_pycurl-0.0.2.tar.gz
  • Upload date:
  • Size: 17.7 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.2.tar.gz
Algorithm Hash digest
SHA256 c0d26c524a9dc6e3dbd7b5b6fa732a4b8ee78c51a71755fc98e42371003dd48c
MD5 2ceca6e35673cd7c5df305a4ec0461f2
BLAKE2b-256 5ebdd72a8edb75530c6cd5b026b3ce4f6c103ebdd56dc05077bd9cf1d948f2df

See more details on using hashes here.

Provenance

The following attestation bundles were made for httpx_pycurl-0.0.2.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.2-py3-none-any.whl.

File metadata

  • Download URL: httpx_pycurl-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 9.1 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 b676441239a52a9d992ab1b631b8e17b655082f0ff241a674ea72fe70bb451e4
MD5 ecef3437a26af204f5feba8e5084293d
BLAKE2b-256 e3de3d405353310f579568c5d3214be23a4f6eb04ba199e7d5f9b46ee6e34500

See more details on using hashes here.

Provenance

The following attestation bundles were made for httpx_pycurl-0.0.2-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