curl_cffi’s documentation¶
Contents:
- Quick Start
- Impersonate Guide
- Advanced Topics
- Compatibility with requests
- Cookies
- Community
- API References
- FAQ
- What does the pro version offer? Is the open source project still maintained?
- Why does the JA3 fingerprints change for Chrome 110+ impersonation?
- Can I bypass Cloudflare with this project? or any other specific site.
- I’m getting certs errors
- ErrCode: 77, Reason: error setting certificate verify locations
- How to use with fiddler/charles to intercept content
- ErrCode: 92, Reason: ‘HTTP/2 stream 0 was not closed cleanly: PROTOCOL_ERROR (err 1)’
- Packaging with PyInstaller
- How to change the order of headers?
- How to deal with encoding/decoding errors?
- Change Log
- Development and contributing
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 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.
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
asynciowith proxy rotation on each request.Supports http 2.0 & 3.0, which requests does not.
Supports websocket.
requests |
aiohttp |
httpx |
pycurl |
curl_cffi |
|
|---|---|---|---|---|---|
http2 |
❌ |
❌ |
✅ |
✅ |
✅ |
http3 |
❌ |
❌ |
❌ |
✅ |
✅ |
sync |
✅ |
❌ |
✅ |
✅ |
✅ |
async |
❌ |
✅ |
✅ |
❌ |
✅ |
websocket |
❌ |
✅ |
❌ |
❌ |
✅ |
fingerprints |
❌ |
❌ |
❌ |
❌ |
✅ |
speed |
🐇 |
🐇🐇 |
🐇 |
🐇🐇 |
🐇🐇 |
Notes:
For pycurl, you need a http/3 enabled libcurl, while curl_cffi packages libcurl-impersonate inside Python wheels.
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 the impersonate.
For advanced topics, checkout Cookies, Asyncio and WebSockets.
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.