curl_cffi

Python HTTP client that impersonates browser TLS and HTTP/2 fingerprints

Library
PyPI
v0.16.0
6,340stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
87/100Excellent
Development Activity88
Maintenance100
Community64
Maturity56
Momentum40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
79/100Good
Architecture80
Code Quality78
Innovation84
Learning Curve80

curl_cffi is a Python HTTP client that binds to a curl-impersonate fork through cffi, letting your requests mimic the TLS/JA3, HTTP/2, and even HTTP/3 fingerprints of real browsers. Unlike pure-Python clients such as requests or httpx, it presents a network fingerprint that anti-bot systems recognize as a genuine browser, so it often gets through where other clients are blocked.

It exposes a familiar requests-style API — plus an asyncio interface and WebSocket support — while handling the low-level libcurl binding for you. That makes it a popular choice for web scraping and automation against sites that fingerprint clients at the TLS layer.

What You Get

  • A requests-style synchronous API (get, post, Session) backed by libcurl
  • Browser impersonation of TLS/JA3, JA4, HTTP/2, and HTTP/3 fingerprints via an impersonate parameter
  • An asyncio client plus WebSocket support for concurrent and streaming workloads
  • Proxy support including SOCKS5, and a CLI for debugging fingerprints
  • Prebuilt wheels bundling the native curl-impersonate library across platforms

Common Use Cases

  • Web scraping sites that block clients by TLS/JA3 fingerprint
  • Automating requests that must appear to originate from a real browser
  • High-throughput async HTTP calls that need curl-level performance
  • Replacing requests/httpx when anti-bot systems reject pure-Python clients

Under The Hood

Architecture - The curl_cffi package layers a Pythonic API over libcurl. curl.py holds the low-level cffi binding to the bundled curl-impersonate build, fingerprints.py encodes the browser TLS/JA3/HTTP2 presets, and the requests/ subpackage provides the high-level requests-style Session, get/post helpers, and response objects. aio.py and _asyncio_selector.py add the asyncio client, and a cli subpackage exposes a debugging command. Native sources live under ffi/ with libs.json describing the prebuilt binaries.

Tech Stack - Python 3.10+ with just two runtime dependencies — cffi>=2.0.0 for the C binding and certifi for CA bundles. The heavy lifting is done by the vendored curl-impersonate C library, shipped as platform wheels built with cibuildwheel. Dev tooling includes pytest, pytest-asyncio, trio, mypy, and ruff.

Code Quality - The project is mature and actively maintained: it ships py.typed, enforces mypy and ruff, and carries an extensive tests/ suite covering sync, async, and trio paths against a local uvicorn server. Pinned dev dependencies and CI wheel builds indicate careful release engineering.

API Design - The public surface intentionally mirrors requests so adoption is nearly free, with browser impersonation reduced to a single impersonate="chrome"-style keyword. Async and WebSocket clients follow the same conventions, and thorough ReadTheDocs documentation plus examples keep the learning curve low despite the native machinery underneath.

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search