curl_cffi - Python binding for curl-impersonate Curl_cffi, the most popular Python binding for curl-impersonate, now supports http/3 fingerprints and UDP socks5 proxy as of v0.15.0, and requires Python 3.10 since v0.14. The library allows browsers' TLS/JA3 and HTTP/2 fingerprint impersonation to bypass website blocking, and is faster than requests/httpx. Python binding for curl-impersonate fork https://github.com/lexiforest/curl-impersonate via cffi https://cffi.readthedocs.io/en/latest/ . For commercial support, visit impersonate.pro https://impersonate.pro . curl cffi is the most popular Python binding for curl . Unlike other pure python http clients like httpx or requests , curl cffi can impersonate browsers' TLS/JA3 and HTTP/2 fingerprints. If you are blocked by some website for no obvious reason, you can give curl cffi a try. Python 3.10 is the minimum supported version since v0.14. - πŸ’¨ http/3 fingerprints and UDP socks5 proxy support was added in v0.15.0 - 🦞 Added curl-cffi CLI and skills for debugging and for claws/agents. If you’re looking for a meeting recording API, consider checking out Recall.ai https://www.recall.ai/?utm source=github&utm medium=sponsorship&utm campaign=lexiforest-curl cffi , an API that records Zoom, Google Meet, Microsoft Teams, in-person meetings, and more. Maintenance of this project is made possible by all the contributors https://github.com/lexiforest/curl cffi/graphs/contributors and sponsors https://github.com/sponsors/lexiforest . If you'd like to sponsor this project and have your avatar or company logo appear below click here https://github.com/sponsors/lexiforest . πŸ’– Yescaptcha is a proxy service that bypasses Cloudflare and uses the API interface to obtain verified cookies e.g. cf clearance . Click here https://yescaptcha.com/i/stfnIO to register: https://yescaptcha.com/i/stfnIO https://yescaptcha.com/i/stfnIO TLS fingerprinting alone isn't enough for modern bot protection. Hyper Solutions https://hypersolutions.co?utm source=github&utm medium=readme&utm campaign=curl cffi provides the missing piece - API endpoints that generate valid antibot tokens for: Akamai β€’ DataDome β€’ Kasada β€’ Incapsula No browser automation. Just simple API calls that return the exact cookies and headers these systems require. πŸš€ Get Your API Key https://hypersolutions.co?utm source=github&utm medium=readme&utm campaign=curl cffi | πŸ“– Docs https://docs.justhyped.dev | πŸ’¬ Discord https://discord.gg/akamai curl-cffi is part of the impersonate suite. curl-impersonate https://github.com/lexiforest/curl-impersonate . A curl distribution that impersonates browsers. curl cffi https://github.com/lexiforest/curl cffi . Python binding to curl-impersonate. impers https://github.com/lexiforest/impers . Node.js binding to curl-impersonate. impersonate.pro https://impersonate.pro . Commercial support, more fingerprints and integrated solutions. - 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 https://github.com/lexiforest/curl cffi/tree/main/benchmark . - Mimics the 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, which requests does not. - Supports http 3.0, with fingerprints and udp proxy. - Supports websocket. - MIT licensed. | requests | aiohttp | httpx | pycurl | curl cffi | | |---|---|---|---|---|---| | http/2 | ❌ | ❌ | βœ… | βœ… | βœ… | | http/3 | ❌ | ❌ | ❌ | β˜‘οΈ1 | βœ…2 | | sync | βœ… | ❌ | βœ… | βœ… | βœ… | | async | ❌ | βœ… | βœ… | ❌ | βœ… | | websocket | ❌ | βœ… | ❌ | ❌ | βœ… | | native retry | ❌ | ❌ | ❌ | ❌ | βœ… | | fingerprints | ❌ | ❌ | ❌ | ❌ | βœ… | | speed | πŸ‡ | πŸ‡πŸ‡ | πŸ‡ | πŸ‡πŸ‡ | πŸ‡πŸ‡ | Notes: - For pycurl, http/3 is usually disabled at compile time by default. - http/3 support since v0.11.4, http/3 proxy and fingerprints since v0.15.0. Since v0.15, curl cffi comes with a CLI called curl-cffi , you can use it for debugging a certain url with the --impersonate option. It can also serve as a web fetch replacement for "claws" and "agents". | curl | httpie | curl-cffi | | |---|---|---|---| | http/2 | βœ… | ❌ | βœ… | | http/3 | β˜‘οΈ1 | ❌ | βœ… | | human-friendly | β˜‘οΈ2 | βœ… | βœ… | | colorful | ❌ | βœ… | βœ…3 | | fingerprints | ❌ | ❌ | βœ… | Notes: - You need an http/3 enabled curl build, it's not enabled by default, at leat on my machine. - As a long time command line user, I personally feel very comfortable using curl -X POST httpbin.org , but some users may prefer http GET httpbin.org syntax. If you prefer the curl syntax, you can keep using curl-impersonate . - Install curl cffi cli for colorful CLI output. Without rich , the CLI uses plain text output. pip install curl cffi --upgrade This should work on Linux, macOS and Windows out of the box. On macOS, you can also install via Homebrew: brew install lexiforest/tap/curl-cffi Android support, including Termux, is currently in beta, you can install the beta release for testing. For BSD systems, we need to get libcurl-impersonate compile first, and then add support in curl cffi. If you are using these OSes, please lend an hand. To install beta releases: pip install curl cffi --upgrade --pre To install unstable version from GitHub: git clone https://github.com/lexiforest/curl cffi/ cd curl cffi make preprocess pip install . curl cffi comes with a low-level curl API and a high-level requests -like API. curl cffi also bundles with a CLI called curl-cffi . curl-cffi get tls.browserleaks.com/json curl-cffi can be hard to type, use an alias if you want alias imp=curl-cffi imp get tls.browserleaks.com/json --impersonate chrome For a complete CLI guide, see docs https://curl-cffi.readthedocs.io . python import curl cffi Notice the impersonate parameter r = curl cffi.get "https://tls.browserleaks.com/json", impersonate="chrome" print r.json output: {..., "ja3n hash": "aa56c057ad164ec4fdcb7a5a283be9fc", ...} the js3n fingerprint should be the same as target browser To keep using the latest browser version as curl cffi updates, simply set impersonate="chrome" without specifying a version. Other similar values are: "safari" and "safari ios" r = curl cffi.get "https://tls.browserleaks.com/json", impersonate="chrome" Use http/3 with impersonation r = curl cffi.get "https://fp.impersonate.pro/api/http3", http version="v3", impersonate="chrome" To pin a specific version, use version numbers together. r = curl cffi.get "https://tls.browserleaks.com/json", impersonate="chrome124" To impersonate other than browsers, bring your own ja3/akamai strings See examples directory for details. r = curl cffi.get "https://tls.browserleaks.com/json", ja3=..., akamai=... http/socks proxies are supported proxies = {"https": "http://localhost:3128"} r = curl cffi.get "https://tls.browserleaks.com/json", impersonate="chrome", proxies=proxies proxies = {"https": "socks://localhost:3128"} r = curl cffi.get "https://tls.browserleaks.com/json", impersonate="chrome", proxies=proxies s = curl cffi.Session httpbin is a http test website, this endpoint makes the server set cookies s.get "https://httpbin.org/cookies/set/foo/bar" print s.cookies