curl_cffi’s documentation

Contents:

Discuss on Telegram

curl_cffi is a Python binding for curl-impersonate fork via cffi. For commercial support, visit impersonate.pro.

Unlike other pure Python http clients like httpx or requests, curl_cffi can impersonate browsers’ TLS signatures or JA3 fingerprints. If you are blocked by some website for no obvious reason, you can give this package a try.

If you are looking for Python http3 clients, curl_cffi added http3 support since v0.11.

Sponsors

Bypass Cloudflare with API

YesCaptcha

Yescaptcha is a proxy service that bypasses Cloudflare and uses the API interface to obtain verified cookies (e.g. cf_clearance). Click here to register.

You can also click here to buy me a coffee.

Residential Proxies

Thordata

Thordata: A reliable and cost-effective proxy service provider. One-click collection of public network data, providing enterprises and developers with stable, efficient, and compliant global proxy IP services. Register for a free trial of residential proxies and receive 2000 free SERP API calls.

Features

  • Supports JA3/TLS and http2 fingerprints impersonation, including recent browsers and custom fingerprints.

  • Much faster than requests/httpx, on par with aiohttp/pycurl, see benchmarks.

  • Mimics requests API, no need to learn another one.

  • Pre-compiled, so you don’t have to compile on your machine.

  • Supports asyncio with proxy rotation on each request.

  • Supports http 2.0 & 3.0, which requests does not.

  • Supports websocket.

Feature matrix

requests

aiohttp

httpx

pycurl

curl_cffi

http2

http3

sync

async

websocket

native retry

fingerprints

speed

🐇

🐇🐇

🐇

🐇🐇

🐇🐇

Notes:

  1. For pycurl, you need a http/3 enabled libcurl, while curl_cffi packages libcurl-impersonate inside Python wheels.

  2. Full http/3 supported was added in v0.12.0.

Install

pip install curl_cffi --upgrade

For more details, see Quick Start.

Documentation

You can first check out Quick Start. Then Impersonate Guide.

For advanced topics, checkout Cookies, Asyncio and WebSockets.

Since v0.15.1, you can update fingerprints without updating curl_cffi, see Fingerprint Updates.

Moreover, we offer comprehensive fingerprint suites at impersonate.pro.

There is a CLI helper for managing fingerprints and debugging, see CLI.

You can also find common use cases in the examples directory.

Finally, if something is missing from the tutorial, you can always find them in the API References.

If you have any questions, be sure to check out the FAQ section before opening an issue.

Indices and tables