Skip to main content

httpx2-pycurl

httpx2-pycurl provides an httpx2 transport that executes requests with pycurl. It combines the goodness of curl with the familiar httpx2 API, including support for http/2 and even non-http protocols built into curl. AsyncPyCurlTransport performs better than httpx2's default AsyncHttpTransport with http2=True, taking about 78% of the time to issue 128 requests in parallel. Under heavier usage httpx2-pycurl appears to pull further ahead of alternative libraries, without replacing all of httpx2; just httpx2's transport.

Usage

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

import httpx2
from httpx2_pycurl import AsyncPyCurlTransport

transport = AsyncPyCurlTransport(timeout=10.0)

async with httpx2.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 httpx2
from httpx2_pycurl import PyCurlTransport

transport = PyCurlTransport(timeout=10.0)

with httpx2.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),
)

Installation

pip install httpx2-pycurl

Or with conda,

conda install -n base conda-pypi
conda pypi install httpx2-pycurl

Performance

Before the rename, httpx-pycurl was tested against httpx. It is in early development but it passed most httpx tests and has good performance. Our tests/bench.py uses asyncio.gather() to make many http/2 requests to https://httpbingo.org/get using httpx, niquests, and httpx with httpx-pycurl's transport. httpx-pycurl was the fastest library tested.

Running tests/bench.py [N] shows that the more efficient http/2 libraries shine when performing large numbers of parallel requests, and are closer together when only groups of 128 parallel requests are made.

2 groups of 512 requests each...

Time per group:
httpx2: 0.679s ± 0.119s
niquests: 0.432s ± 0.140s
httpx2_pycurl: 0.299s ± 0.056s

Paired t-test: httpx2_pycurl vs niquests
t-stat: -2.249 (approx p < 0.05 if |t| > 2.365)
Speedup: 1.44x
4 groups of 256 requests each...

Time per group:
httpx2: 0.378s ± 0.077s
niquests: 0.259s ± 0.064s
httpx2_pycurl: 0.190s ± 0.034s

Paired t-test: httpx2_pycurl vs niquests
t-stat: -4.208 (approx p < 0.05 if |t| > 2.365)
Speedup: 1.36x
8 groups of 128 requests each...

Time per group:
httpx2: 0.215s ± 0.073s
niquests: 0.205s ± 0.038s
httpx2_pycurl: 0.162s ± 0.033s

Paired t-test: httpx2_pycurl vs niquests
t-stat: -8.949 (approx p < 0.05 if |t| > 2.365)
Speedup: 1.27x

Dependencies

httpx2-pycurl uses curl to support http/2 instead of the h2, hpack and hyperframe dependencies used by httpx2.

$ pip install --dry-run httpx2-pycurl
...
Would install anyio-4.13.0 certifi-2026.4.22 h11-0.16.0 httpcore2-2.16.0 httpx2-2.16.0 httpx2-pycurl-0.0.5 idna-3.20 pycurl-7.45.7 truststore-0.10.5

$ pip install --dry-run httpx2[http2]
...
Would install anyio-4.13.0 certifi-2026.4.22 h2-4.3.0 h11-0.16.0 hpack-4.1.0 httpcore2-2.16.0 httpx2-2.16.0 hyperframe-6.1.0 idna-3.20 truststore-0.10.5

Metadata

Release files for httpx2-pycurl 0.0.7

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

Source distribution (sdist)

Source distribution for httpx2-pycurl 0.0.7
File Size Uploaded Provenance Actions
httpx2_pycurl-0.0.7.tar.gz 26.3 kB With provenance Details for httpx2_pycurl-0.0.7.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for httpx2-pycurl 0.0.7
File Interpreter ABI Platform Actions
httpx2_pycurl-0.0.7-py3-none-any.whl Python 3 none any Details for httpx2_pycurl-0.0.7-py3-none-any.whl

Total release size: 40.3 kB

Release files / httpx2_pycurl-0.0.7.tar.gz

Download URL httpx2_pycurl-0.0.7.tar.gz
Size 26.3 kB
Tags Source
SHA-256 checksum
How to use checksums
6ae255600c2d2c6dc0bae6f47621ea99911b290939b954307736ec5e6be18cc0
BLAKE2b-256 checksum
How to use checksums
1c4d9f91ab9b395ca9ff72d78788e6212acf43458d661011fdfcc5cfd3051046
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 12, 2026.

Transparency log

Release files / httpx2_pycurl-0.0.7-py3-none-any.whl

Download URL httpx2_pycurl-0.0.7-py3-none-any.whl
Size 14.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
030809ec60d2064e2531e63d730fb4bd0ff2faeaceb94447711aa674b7fbad7b
BLAKE2b-256 checksum
How to use checksums
69d78f8ac792bc2d879d93b9837ecad3ebc40a625373dbc89f54f11e1968026d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 12, 2026.

Transparency log

Security for httpx2-pycurl 0.0.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for httpx2_pycurl-0.0.7.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 12, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.0.7 This release

2 release files Full provenance

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