{"slug": "curl-cffi-python-binding-for-curl-impersonate", "title": "curl_cffi - Python binding for curl-impersonate", "summary": "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.", "body_md": "Python binding for [curl-impersonate fork](https://github.com/lexiforest/curl-impersonate)\nvia [cffi](https://cffi.readthedocs.io/en/latest/). For commercial support, visit [impersonate.pro](https://impersonate.pro).\n\n`curl_cffi`\n\nis the most popular Python binding for `curl`\n\n. Unlike other pure\npython http clients like `httpx`\n\nor `requests`\n\n, `curl_cffi`\n\ncan impersonate\nbrowsers' TLS/JA3 and HTTP/2 fingerprints. If you are blocked by some\nwebsite for no obvious reason, you can give `curl_cffi`\n\na try.\n\nPython 3.10 is the minimum supported version since v0.14.\n\n- 💨 http/3 fingerprints and UDP socks5 proxy support was added in\n`v0.15.0`\n\n! - 🦞 Added\n`curl-cffi`\n\nCLI and skills for debugging and for claws/agents.\n\nIf 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.\n\nMaintenance 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). 💖\n\nYescaptcha is a proxy service that bypasses Cloudflare and uses the API interface to\nobtain verified cookies (e.g. `cf_clearance`\n\n). Click [here](https://yescaptcha.com/i/stfnIO)\nto register: [https://yescaptcha.com/i/stfnIO](https://yescaptcha.com/i/stfnIO)\n\nTLS 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:\n\nAkamai • DataDome • Kasada • Incapsula\n\nNo browser automation. Just simple API calls that return the exact cookies and headers these systems require.\n\n🚀 [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)\n\n`curl-cffi`\n\nis part of the impersonate suite.\n\n[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.\n\n- Supports JA3/TLS and http2 fingerprints impersonation, including recent browsers and custom fingerprints.\n- Much faster than requests/httpx, on par with aiohttp/pycurl, see\n[benchmarks](https://github.com/lexiforest/curl_cffi/tree/main/benchmark). - Mimics the requests API, no need to learn another one.\n- Pre-compiled, so you don't have to compile on your machine.\n- Supports\n`asyncio`\n\nwith proxy rotation on each request. - Supports http 2.0, which requests does not.\n- Supports http 3.0, with fingerprints and udp proxy.\n- Supports websocket.\n- MIT licensed.\n\n| requests | aiohttp | httpx | pycurl | curl_cffi | |\n|---|---|---|---|---|---|\n| http/2 | ❌ | ❌ | ✅ | ✅ | ✅ |\n| http/3 | ❌ | ❌ | ❌ | ☑️1 |\n✅2 |\n| sync | ✅ | ❌ | ✅ | ✅ | ✅ |\n| async | ❌ | ✅ | ✅ | ❌ | ✅ |\n| websocket | ❌ | ✅ | ❌ | ❌ | ✅ |\n| native retry | ❌ | ❌ | ❌ | ❌ | ✅ |\n| fingerprints | ❌ | ❌ | ❌ | ❌ | ✅ |\n| speed | 🐇 | 🐇🐇 | 🐇 | 🐇🐇 | 🐇🐇 |\n\nNotes:\n\n- For pycurl, http/3 is usually disabled at compile time by default.\n- http/3 support since v0.11.4, http/3 proxy and fingerprints since v0.15.0.\n\nSince v0.15, `curl_cffi`\n\ncomes with a CLI called `curl-cffi`\n\n, you can use it for debugging\na certain url with the `--impersonate`\n\noption. It can also serve as a `web_fetch`\n\nreplacement for \"claws\" and \"agents\".\n\n| curl | httpie | curl-cffi | |\n|---|---|---|---|\n| http/2 | ✅ | ❌ | ✅ |\n| http/3 | ☑️1 |\n❌ | ✅ |\n| human-friendly | ☑️2 |\n✅ | ✅ |\n| colorful | ❌ | ✅ | ✅3 |\n| fingerprints | ❌ | ❌ | ✅ |\n\nNotes:\n\n- You need an http/3 enabled curl build, it's not enabled by default, at leat on my machine.\n- As a long time command line user, I personally feel very comfortable using\n`curl -X POST httpbin.org`\n\n, but some users may prefer`http GET httpbin.org`\n\nsyntax. If you prefer the curl syntax, you can keep using`curl-impersonate`\n\n. - Install\n`curl_cffi[cli]`\n\nfor colorful CLI output. Without`rich`\n\n, the CLI uses plain text output.\n\n```\npip install curl_cffi --upgrade\n```\n\nThis should work on Linux, macOS and Windows out of the box.\n\nOn macOS, you can also install via Homebrew:\n\n```\nbrew install lexiforest/tap/curl-cffi\n```\n\nAndroid 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.\n\nTo install beta releases:\n\n```\npip install curl_cffi --upgrade --pre\n```\n\nTo install unstable version from GitHub:\n\n```\ngit clone https://github.com/lexiforest/curl_cffi/\ncd curl_cffi\nmake preprocess\npip install .\n```\n\n`curl_cffi`\n\ncomes with a low-level `curl`\n\nAPI and a high-level `requests`\n\n-like API.\n`curl_cffi`\n\nalso bundles with a CLI called `curl-cffi`\n\n.\n\n```\ncurl-cffi get tls.browserleaks.com/json\n\n# curl-cffi can be hard to type, use an alias if you want\nalias imp=curl-cffi\nimp get tls.browserleaks.com/json --impersonate chrome\n```\n\nFor a complete CLI guide, see [docs](https://curl-cffi.readthedocs.io).\n\n``` python\nimport curl_cffi\n\n# Notice the impersonate parameter\nr = curl_cffi.get(\"https://tls.browserleaks.com/json\", impersonate=\"chrome\")\n\nprint(r.json())\n# output: {..., \"ja3n_hash\": \"aa56c057ad164ec4fdcb7a5a283be9fc\", ...}\n# the js3n fingerprint should be the same as target browser\n\n# To keep using the latest browser version as `curl_cffi` updates,\n# simply set impersonate=\"chrome\" without specifying a version.\n# Other similar values are: \"safari\" and \"safari_ios\"\nr = curl_cffi.get(\"https://tls.browserleaks.com/json\", impersonate=\"chrome\")\n\n# Use http/3 with impersonation\nr = curl_cffi.get(\n    \"https://fp.impersonate.pro/api/http3\",\n    http_version=\"v3\",\n    impersonate=\"chrome\"\n)\n\n# To pin a specific version, use version numbers together.\nr = curl_cffi.get(\"https://tls.browserleaks.com/json\", impersonate=\"chrome124\")\n\n# To impersonate other than browsers, bring your own ja3/akamai strings\n# See examples directory for details.\nr = curl_cffi.get(\"https://tls.browserleaks.com/json\", ja3=..., akamai=...)\n\n# http/socks proxies are supported\nproxies = {\"https\": \"http://localhost:3128\"}\nr = curl_cffi.get(\"https://tls.browserleaks.com/json\", impersonate=\"chrome\", proxies=proxies)\n\nproxies = {\"https\": \"socks://localhost:3128\"}\nr = curl_cffi.get(\"https://tls.browserleaks.com/json\", impersonate=\"chrome\", proxies=proxies)\ns = curl_cffi.Session()\n\n# httpbin is a http test website, this endpoint makes the server set cookies\ns.get(\"https://httpbin.org/cookies/set/foo/bar\")\nprint(s.cookies)\n# <Cookies[<Cookie foo=bar for httpbin.org />]>\n\n# retrieve cookies again to verify\nr = s.get(\"https://httpbin.org/cookies\")\nprint(r.json())\n# {'cookies': {'foo': 'bar'}}\n```\n\n`curl_cffi`\n\nsupports the same browser versions preset as supported by our [fork](https://github.com/lexiforest/curl-impersonate) of [curl-impersonate](https://github.com/lwthiker/curl-impersonate):\n\nThe open source version of `curl_cffi`\n\nincludes versions when we are adding new capabilities for impersonating.\nIf you see a version, e.g. `chrome135`\n\n, was skipped, it's simply because there's nothing new or we were busy at that time.\nYou can simply impersonate it with your own headers and the previous browser target.\n\nFor a full list of preset fingerprints, see the [curl-impersonate docs](https://curl-impersonate.readthedocs.io/en/latest/fingerprints.html).\nWe will no longer put duplicated and outdated info here.\n\nIf you don't want to look up the headers/etc by yourself, consider buying commercial support from [impersonate.pro](https://impersonate.pro).\nWe have comprehensive browser tls, http and JavaScript fingerprints database for almost all the browser versions on various platforms.\n\nSince v0.15.1, you can use `curl-cffi update`\n\nto retrieve the latest fingerprints, without updating to a new version.\nWe offer the Safari, Chrome, Firefox updates for free and others as part of the [commercial plan](https://impersonate.pro).\n\nThe current number of fingerprints:\n\nTo see the current list of fingerprints on your device, use the command line:\n\n```\ncurl-cffi list\n```\n\nTo update fingerprints from impersonate.pro, use the command line:\n\n```\ncurl-cffi update\n```\n\nIf you are trying to impersonate a target other than a browser, use `ja3=...`\n\n, `akamai=...`\n\n, `extra_fp=...`\n\n, and `perk=...`\n\nto specify your own customized fingerprints. See the [docs on impersonation](https://curl-cffi.readthedocs.io/en/latest/impersonate/_index.html) for details.\n\n``` python\nfrom curl_cffi import AsyncSession\n\nasync with AsyncSession() as s:\n    r = await s.get(\"https://example.com\")\n```\n\nMore concurrency:\n\n``` python\nimport asyncio\nfrom curl_cffi import AsyncSession\n\nurls = [\n    \"https://google.com/\",\n    \"https://facebook.com/\",\n    \"https://twitter.com/\",\n]\n\nasync with AsyncSession() as s:\n    tasks = []\n    for url in urls:\n        task = s.get(url)\n        tasks.append(task)\n    results = await asyncio.gather(*tasks)\n```\n\nFor low-level APIs, Scrapy integration and other advanced topics, see the\n[docs](https://curl-cffi.readthedocs.io) for more details.\n\n``` python\nfrom curl_cffi import WebSocket\n\ndef on_message(ws: WebSocket, message: str | bytes):\n    print(message)\n\nws = WebSocket(on_message=on_message)\nws.run_forever(\"wss://api.gemini.com/v1/marketdata/BTCUSD\")\npython\nimport asyncio\nfrom curl_cffi import AsyncSession\n\nasync with AsyncSession() as session:\n    async with session.ws_connect(\"wss://echo.websocket.org\") as ws:\n        await asyncio.gather(*[ws.send_str(\"Hello, World!\") for _ in range(10)])\n        async for message in ws:\n            print(message)\n```\n\nSee the WebSocket [docs](https://curl-cffi.readthedocs.io/en/latest/websockets.html) for full details and advanced options.\n\n- Integrating with Scrapy:\n[divtiply/scrapy-curl-cffi](https://github.com/divtiply/scrapy-curl-cffi),[jxlil/scrapy-impersonate](https://github.com/jxlil/scrapy-impersonate)and[tieyongjie/scrapy-fingerprint](https://github.com/tieyongjie/scrapy-fingerprint). - Integrating with\n[requests](https://github.com/el1s7/curl-adapter),[httpx](https://github.com/vgavro/httpx-curl-cffi)as adapter. - Integrating with captcha resolvers:\n[YesCaptcha](https://yescaptcha.com/i/stfnIO).\n\n- Originally forked from\n[multippt/python_curl_cffi](https://github.com/multippt/python_curl_cffi), which is under the MIT license. - Headers/Cookies files are copied from\n[httpx](https://github.com/encode/httpx/blob/master/httpx/_models.py), which is under the BSD license. - Asyncio support is inspired by Tornado's curl http client.\n- The synchronous WebSocket API is inspired by\n[websocket_client](https://github.com/websocket-client/websocket-client). - The asynchronous WebSocket API is inspired by\n[aiohttp](https://github.com/aio-libs/aiohttp).\n\nWhen submitting an PR, please use a different branch other than `main`\n\nand check the\n\"Allow edits by maintainers\" box, so I can update your PR with lint or style fixes. Thanks!\n\n- Using AI is neither encouraged nor discouraged, use it by your own choice.\n- The bottom line here is that every line of code should be\n**reviewed by human**, and should be[proven to work](https://simonwillison.net/2025/Dec/18/code-proven-to-work/). - It's not guaranteed that AI will come up with the cleanest solution, you are responsible to guide it to the right way you know.\n- Fix any lint errors, make sure your code follows the established convention in this project.\n- LLM tends to generate extensive or none comments, revise the comments and make sure they are concise and helpful.\n- It's absolutely\n**not acceptable** to generate the entire PR summary by LLM. To communicate with other human, use words from a human. - The only acceptable exception is to fix grammar issues if you are not a native English speaker.\n- The essence here is to keep\n[Human in the loop](https://discourse.llvm.org/t/rfc-llvm-ai-tool-policy-human-in-the-loop/89159)\n\nYou can even feed the policy above to your \"copilot\" to let it adjust the style for you. :P", "url": "https://wpnews.pro/news/curl-cffi-python-binding-for-curl-impersonate", "canonical_source": "https://github.com/lexiforest/curl_cffi", "published_at": "2026-07-21 02:19:43+00:00", "updated_at": "2026-07-21 02:53:02.382468+00:00", "lang": "en", "topics": ["developer-tools", "artificial-intelligence"], "entities": ["curl_cffi", "curl-impersonate", "lexiforest", "Python", "Recall.ai", "Yescaptcha", "Hyper Solutions", "impersonate.pro"], "alternates": {"html": "https://wpnews.pro/news/curl-cffi-python-binding-for-curl-impersonate", "markdown": "https://wpnews.pro/news/curl-cffi-python-binding-for-curl-impersonate.md", "text": "https://wpnews.pro/news/curl-cffi-python-binding-for-curl-impersonate.txt", "jsonld": "https://wpnews.pro/news/curl-cffi-python-binding-for-curl-impersonate.jsonld"}}