{"repo":"lexiforest/curl_cffi","free":true,"listed":false,"github":"https://github.com/lexiforest/curl_cffi","clone":"git clone https://github.com/lexiforest/curl_cffi.git","description":"Python binding for curl-impersonate fork via cffi. A http client that can impersonate browser tls/ja3/http2 fingerprints.","language":"Python","stars":6321,"topics":["akamai-fingerprint","curl","curl-impersonate","fingerprinting","http","http-client","http2-fingerprint","http3-fingerprints","https","ja3","ja3-fingerprint","ja4","ja4-fingerprint","quic-fingerprints","tls-fingerprint","web-scraping"],"license":"MIT","category":"web_scraping","readme_excerpt":"# curl_cffi\n\n[![PyPI Downloads](https://static.pepy.tech/badge/curl-cffi/week)](https://pepy.tech/projects/curl-cffi)\n![PyPI - Python Version](https://img.shields.io/pypi/pyversions/curl_cffi)\n[![PyPI version](https://badge.fury.io/py/curl-cffi.svg)](https://badge.fury.io/py/curl-cffi)\n[![Generic badge](https://img.shields.io/badge/Telegram%20Channel-join-blue?logo=telegram)](https://t.me/impersonate_pro)\n[![Generic badge](https://img.shields.io/badge/Discord-join-purple?logo=blue)](https://discord.gg/kJqMHHgdn2)\n\n[Documentation](https://curl-cffi.readthedocs.io)\n\nPython 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` is the most popular Python binding for `curl`. Unlike other pure\npython http clients like `httpx` or `requests`, `curl_cffi` can impersonate\nbrowsers' TLS/JA3 and HTTP/2 fingerprints. If you are blocked by some\nwebsite for no obvious reason, you can give `curl_cffi` a try.\n\nPython 3.10 is the minimum supported version since v0.14.\n\n## Recent highlights\n\n- 💨 http/3 fingerprints and UDP socks5 proxy support was added in `v0.15.0`!\n- 🦞 Added `curl-cffi` CLI and skills for debugging and for claws/agents.\n\n## Recall.ai - API for meeting recordings\n\n<a href=\"https://www.recall.ai/?utm_source=github&utm_medium=sponsorship&utm_campaign=lexiforest-curl_cffi\" target=\"_blank\"><img src=\"https://cdn.prod.website-files.com/620d732b1f1f7b244ac89f0e/66b294e51ee15f18dd2b171e_recall-logo.svg\" alt=\"Recall.ai\" height=\"47\" width=\"149\"></a>\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\n## Sponsors\n\nMaintenance of this project is made possible by all the <a href=\"https://github.com/lexiforest/curl_cffi/graphs/contributors\">contributors</a> and <a href=\"https://github.com/sponsors/lexiforest\">sponsors</a>. If you'd like to sponsor this project and have your avatar or company logo appear below <a href=\"https://github.com/sponsors/lexiforest\">click here</a>. 💖\n\n------\n\n### Bypass Cloudflare with API\n\n<a href=\"https://yescaptcha.com/i/stfnIO\" target=\"_blank\"><img src=\"https://raw.githubusercontent.com/lexiforest/curl_cffi/main/assets/yescaptcha.png\" alt=\"Yes Captcha!\" height=\"47\" width=\"149\"></a>\n\nYescaptcha is a proxy service that bypasses Cloudflare and uses the API interface to\nobtain verified cookies (e.g. `cf_clearance`). Click [here](https://yescaptcha.com/i/stfnIO)\nto register: <https://yescaptcha.com/i/stfnIO>\n\n------\n\n<a href=\"https://hypersolutions.co/?utm_source=github&utm_medium=readme&utm_campaign=curl_cffi\" target=\"_blank\"><img src=\"https://raw.githubusercontent.com/lexiforest/curl_cffi/main/assets/hypersolutions.png\" height=\"47\" width=\"149\"></a>\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------\n\n## Impersonate Suite\n\n`curl-cffi` is part of the impersonate suite.\n\n- [curl-impersonate](https://github.com/lexiforest/curl-impersonate). A curl distribution that impersonates browsers.\n- [curl_cffi](https://github.com/lexiforest/curl_cffi). Python binding to curl-impersonate.\n- [impers](https://github.com/lexiforest/impers). Node.js binding to curl-impersonate.\n- [impersonate.pro](https://impersonate.pro). Commercial support, more fingerprints and integrated solutions.\n\n## Features\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 [benchmarks](https://github.com/lexiforest/curl_cffi/tree/main/benchmark).\n- 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 `asyncio` with proxy rotation on each request.\n- 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|❌|❌|❌|☑️<sup>1</sup>|✅<sup>2</sup>|\n|sync|✅|❌|✅|✅|✅|\n|async|❌|✅|✅|❌|✅|\n|websocket|❌|✅|❌|❌|✅|\n|native retry|❌|❌|❌|❌|✅|\n|fingerprints|❌|❌|❌|❌|✅|\n|speed|🐇|🐇🐇|🐇|🐇🐇|🐇🐇|\n\nNotes:\n\n1. For pycurl, http/3 is usually disabled at compile time by default.\n2. http/3 support since v0.11.4, http/3 proxy and fingerprints since v0.15.0.\n\n### curl-cffi CLI(new)\n\nSince v0.15, `curl_cffi` comes with a CLI called `curl-cffi`, you can use it for debugging\na certain url with the `--impersonate` option. It can also serve as a `web_fetch`\nreplacement for \"claws\" and \"agents\".\n\n||curl|httpie|curl-cffi|\n|---|---|---|---|\n|http/2|✅|❌|✅|\n|http/3|☑️<sup>1</sup>|❌|✅|\n|human-friendly|☑️<sup>2</sup>|✅|✅|\n|colorful|❌|✅|✅<sup>3</sup>|\n|fingerprints|❌|❌|✅|\n\nNotes:\n\n1. You need an http/3 enabled curl build, it's not enabled by default, at leat on my machine.\n2. 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`.\n3. Install `curl_cffi[cli]` for colorful CLI output. Without `rich`, the CLI uses plain text output.\n\n## Install\n\n    pip install curl_cffi --upgrade\n\nThis should work on Linux, macOS and Windows out of the box.\n\nOn macOS, you can also install via Homebrew:\n\n    brew install lexiforest/tap/curl-cffi\n\n<small>Android support, including Termux, is currently in beta, you can install the beta release for testing.\nFor BSD systems, we need to get libcurl-impersonate compile first, and then add support in curl_cffi.\nIf you are using these OSes, please lend an hand.</small>\n\nTo install beta releases:\n\n    pip install curl_cffi --upgrade --pre\n\nTo install unstable version from GitHub:\n\n    git clone https://github.com/lexiforest/curl_cffi/\n    cd curl_cffi\n    make preprocess\n    pip install .\n\n## Usage\n\n`curl_cffi` comes with a low-level `curl` API and a high-level `requests`-like API.\n`curl_cffi` also bundles with a CLI called `curl-cffi`.\n\n### CLI\n\n```sh\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### requests-like\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)\n```\n\n### Sessions\n\n```python\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### Supported impersonate browsers\n\n`curl_cffi` supports 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` includes versions when we are adding new capabilities for impersonating.\nIf you see a version, e.g. `chrome135`, 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` to 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 [commercia","default_branch":"main","files":153,"tree":[".githooks/pre-commit",".github/FUNDING.yml",".github/ISSUE_TEMPLATE/bug_report.md",".github/ISSUE_TEMPLATE/feature_request.md",".github/ISSUE_TEMPLATE/fingerprint_report.md",".github/ISSUE_TEMPLATE/question.md",".github/pull_request_template.md",".github/workflows/build-and-test.yaml",".github/workflows/pr-checklist.yaml",".github/workflows/release.yaml",".github/workflows/test-pro.yaml",".gitignore",".readthedocs.yaml","AGENTS.md","LICENSE","MANIFEST.in","Makefile","README.md","assets/hypersolutions.png","assets/scrapfly.png","assets/thordata.png","assets/yescaptcha.png","benchmark/README.md","benchmark/benchmark.py","benchmark/hardware.txt","benchmark/multiple_workers.csv","benchmark/requirements.txt","benchmark/server.py","benchmark/single_worker.csv","benchmark/ws_bench_1_client.py","benchmark/ws_bench_1_server.py","benchmark/ws_bench_2.py","benchmark/ws_bench_utils.py","curl_cffi/__init__.py","curl_cffi/__main__.py","curl_cffi/__version__.py","curl_cffi/_asyncio_selector.py","curl_cffi/aio.py","curl_cffi/cli/__init__.py","curl_cffi/cli/doctor.py","curl_cffi/cli/output.py","curl_cffi/cli/parse.py","curl_cffi/cli/pro.py","curl_cffi/cli/request.py","curl_cffi/cli/run.py","curl_cffi/const.py","curl_cffi/curl.py","curl_cffi/fingerprints.py","curl_cffi/py.typed","curl_cffi/requests/__init__.py","curl_cffi/requests/cache.py","curl_cffi/requests/cookies.py","curl_cffi/requests/errors.py","curl_cffi/requests/exceptions.py","curl_cffi/requests/headers.py","curl_cffi/requests/impersonate.py","curl_cffi/requests/models.py","curl_cffi/requests/session.py","curl_cffi/requests/streams.py","curl_cffi/requests/utils.py","curl_cffi/requests/websockets.py","curl_cffi/utils.py","docs/Makefile","docs/advanced.rst","docs/api.rst","docs/asyncio.rst","docs/changelog.rst","docs/cli/_index.rst","docs/cli/doctor.rst","docs/cli/options.rst","docs/cli/pro.rst","docs/cli/request_params.rst","docs/cli/run.rst","docs/cli/vs_others.rst","docs/community.rst","docs/conf.py","docs/cookies.rst","docs/dev.rst","docs/faq.rst","docs/fingerprints.rst","docs/impersonate/_index.rst","docs/impersonate/customize.rst","docs/impersonate/faq.rst","docs/impersonate/fingerprint.rst","docs/impersonate/ja4.rst","docs/impersonate/psk.rst","docs/impersonate/targets.rst","docs/index.rst","docs/make.bat","docs/quick_start.rst","docs/requirements.txt","docs/security.rst","docs/vs-requests.rst","docs/websockets.rst","examples/async_session.py","examples/curl_like.py","examples/custom_response_class.py","examples/impersonate.py","examples/keyboard_interrupt.py","examples/requests_like.py","examples/scrapy_integration.py","examples/stream.py","examples/upload.py","examples/websockets/long_running.py","examples/websockets/long_running_async.py","examples/websockets/short_running.py","examples/websockets/simple_echo_async.py","examples/websockets/simple_hft_async.py","examples/websockets/simple_sub_async.py","ffi/cdef.c","ffi/shim.c","ffi/shim.h","libs.json","pyproject.toml","scripts/build.py","scripts/bump_version.sh","scripts/check_preset.py","scripts/download_curl.sh","scripts/generate_consts.py","scripts/homebrew.py","setup.py","skills/imp-fetch/SKILL.md","tests/integration/test_fingerprints.py","tests/integration/test_httpbin.py","tests/integration/test_real_world.py","tests/integration/test_response_class.py","tests/pro/conftest.py","tests/pro/test_fp_verify.py","tests/pro/test_pro.py","tests/threads/test_eventlet.py","tests/threads/test_gevent.py","tests/unittest/cli/test_doctor.py","tests/unittest/cli/test_output.py","tests/unittest/cli/test_parse.py","tests/unittest/cli/test_pro_command.py","tests/unittest/cli/test_request.py","tests/unittest/cli/test_run.py","tests/unittest/conftest.py","tests/unittest/test_async.py","tests/unittest/test_async_session.py","tests/unittest/test_async_websockets.py","tests/unittest/test_cache.py","tests/unittest/test_cookies.py","tests/unittest/test_curl.py","tests/unittest/test_fingerprint_application.py","tests/unittest/test_fingerprints.py","tests/unittest/test_headers.py","tests/unittest/test_impersonate.py","tests/unittest/test_requests.py","tests/unittest/test_setopt.py","tests/unittest/test_smoke.py","tests/unittest/test_upload.py","tests/unittest/test_websockets.py"],"storefront":"/r/lexiforest","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/lexiforest/curl_cffi/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}