Skip to main content

httpx-curl-cffi

httpx transport for curl_cffi - python binding for curl-impersonate fork

Unlike other pure python http clients like httpx (with native transport) or requests, curl_cffi can impersonate browser's TLS/JA3 and HTTP/2 fingerprints.

Browser simulation implemented by low-level customizations and usage of native browser TLS libraries (BoringSSL for Chrome, nss for Firefox) - which is impossible to achieve with Python's OpenSSL binding.

If you are blocked by some website for no obvious reason, you can give curl_cffi a try.

Install

pip install httpx-curl-cffi

Usage

from httpx import Client, AsyncClient
from httpx_curl_cffi import CurlTransport, AsyncCurlTransport, CurlOpt

client = Client(transport=CurlTransport(impersonate="chrome", default_headers=True))
client.get("https://tools.scrapfly.io/api/fp/ja3")

async_client = AsyncClient(
    transport=AsyncCurlTransport(
        impersonate="chrome",
        default_headers=True,
        # required for parallel requests, see curl_cffi issues below
        curl_options={CurlOpt.FRESH_CONNECT: True},
    )
)

httpx2

httpx2 is supported along with httpx (installed as dependency) without any changes, the same transports are accepted by httpx2.Client and httpx2.AsyncClient (by type checkers too):

pip install httpx-curl-cffi[httpx2]

The httpx2 extra installs httpx2[brotli,zstd] - decoders of encodings accepted by impersonated browsers (e.g. chrome sends Accept-Encoding: gzip, deflate, br, zstd).

from httpx2 import Client
from httpx_curl_cffi import CurlTransport

client = Client(transport=CurlTransport(impersonate="chrome", default_headers=True))

Responses and errors are created of the request's module, e.g. httpx2.ConnectError raised for httpx2.Client. httpx aliased by httpx2.alias_httpx() is supported as well.

Proxy from environment variables

Note that httpx.Client and httpx.AsyncClient disables proxy configuration from environment variables on providing transport argument even with trust_env=True (default), to have this configured in the same way as native transport use snippet below:

import httpx
from httpx._utils import get_environment_proxies
from httpx_curl_cffi import CurlTransport  # or AsyncCurlTransport


def transport_factory(proxy: httpx.Proxy | None = None) -> httpx.BaseTransport:
    return CurlTransport(  # or AsyncCurlTransport
        proxy=proxy,
        verify=False,  # and other custom options
    )


client = httpx.Client(  # or httpx.AsyncClient
    transport=transport_factory(),
    mounts={
        k: transport_factory(httpx.Proxy(url=v)) if v else None
        for k, v in get_environment_proxies().items()
    },
)

TODO

  • httpx.Request content completely read in memory before sending, not sure if it's fixable with curl_cffi at all
  • CurlTransport.cert argument should support in-memory data instead of filenames, pathlib.Path (instead of strings in httpx._types.CertTypes) is forced

curl_cffi issues

Known limitations

  • httpx.Timeout.write is ignored (libcurl limitation)

  • CurlTransport.verify as ssl.SSLContext isn't supported (because OpenSSL is not used)

  • CurlTransport.trust_env argument is ignored, libcurl is always using environment variables for configuration, which is disabled for proxies using CurlOpt.NOPROXY setting to make proxy argument have complete control on proxy usage, but may have effect in TLS configuration (but may not be used by curl-impersonate fork, idk) https://github.com/lexiforest/curl_cffi/issues/345

  • httpx.Response.request.headers isn't updated with default curl-impersonate headers, which can be unexpected on CurlTransport.default_headers=True https://github.com/lexiforest/curl_cffi/issues/368

  • CurlTransport.cert argument isn't compatible with (deprecated) httpx._types.CertTypes - impossible to pass password as third tuple element, pathlib.Path (instead of strings in httpx._types.CertTypes) is forced

Metadata

Release files for httpx-curl-cffi 0.1.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 httpx-curl-cffi 0.1.7
File Size Uploaded Provenance Actions
httpx_curl_cffi-0.1.7.tar.gz 121.0 kB With provenance Details for httpx_curl_cffi-0.1.7.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for httpx-curl-cffi 0.1.7
File Interpreter ABI Platform Actions
httpx_curl_cffi-0.1.7-py3-none-any.whl Python 3 none any Details for httpx_curl_cffi-0.1.7-py3-none-any.whl

Total release size: 131.1 kB

Release files / httpx_curl_cffi-0.1.7.tar.gz

Download URL httpx_curl_cffi-0.1.7.tar.gz
Size 121.0 kB
Tags Source
SHA-256 checksum
How to use checksums
87e9e7313eeaa1b7d17d104d9292f95ad17de73166a9b64a523cece6a7583c0e
BLAKE2b-256 checksum
How to use checksums
a6c90c773e44ec5454666011b725fc4280998c075d3da60c507af76f97a63c4b
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 28, 2026.

Transparency log

Release files / httpx_curl_cffi-0.1.7-py3-none-any.whl

Download URL httpx_curl_cffi-0.1.7-py3-none-any.whl
Size 10.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
be25c9def94e2d7eb5dfe1af8ead3a53fd1e68fb70a07e559d2a522b1b1516d4
BLAKE2b-256 checksum
How to use checksums
3b6aa843f6361690c98a5c863c793a23de66ebb0cc53abbbd57ce8663732a2f7
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 28, 2026.

Transparency log

Security for httpx-curl-cffi 0.1.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 httpx_curl_cffi-0.1.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 28, 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.

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