Cloudflare Turnstile Solver
Get past a Cloudflare Turnstile challenge once, then scrape with curl_cffi.
Note: intended for accessing sites you are allowed to access programmatically.
Installation
# uv
uv add cfts-solver
# pip
pip install cfts-solver
You also need Google Chrome or Chromium on the host. It runs once per host, to clear the challenge; every request after that is plain HTTP.
Use
import cfts_solver
from curl_cffi import requests
URL = "https://example.com/"
session = requests.Session(impersonate="chrome")
res = session.get(URL)
if cfts_solver.is_challenged(res.headers, res.text):
clearance = cfts_solver.solve_challenge(URL)
clearance.apply(session) # cookies plus the user agent that earned them
res = session.get(URL)
print(res.status_code, len(res.text))
from cfts_solver import TurnstileSession
with TurnstileSession() as session:
res = session.get("https://example.com/")
print(res.status_code)
from cfts_solver import TurnstileSolver
solver = TurnstileSolver()
clearance = solver.solve("https://example.com/")
refreshed = solver.solve("https://example.com/", refresh=True)
print(clearance.token, clearance.user_agent)
Clearances are cached under $XDG_CACHE_HOME/cfts-solver/, keyed by host
and proxy, so a second process does not start a second browser. Pass
ClearanceStore.in_memory() to keep nothing, or ClearanceStore(path) to keep
it somewhere else.
License
Metadata
Release files for cfts-solver 0.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| cfts_solver-0.0.0.tar.gz | 16.6 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| cfts_solver-0.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 37.0 kB
Release files / cfts_solver-0.0.0.tar.gz
| Download URL | cfts_solver-0.0.0.tar.gz |
|---|---|
| Size | 16.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3c4e40be36762e299159fb657c58f2f74d2f03d0e98c3288e01b7c4529dcf783
|
|
BLAKE2b-256 checksum How to use checksums |
24323e537f2c49099480eb31c07c733a4fdd05f0a147b911d6bacd929cd83d1d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / cfts_solver-0.0.0-py3-none-any.whl
| Download URL | cfts_solver-0.0.0-py3-none-any.whl |
|---|---|
| Size | 20.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
00fe4c0931cbb07f108a9a75f9016177e055e249af0d0c556120ae22b2583fd3
|
|
BLAKE2b-256 checksum How to use checksums |
875bba3ca0166c5608e3dbd7e6e03a7ac699bf5ea5d22f854e39c3b9abb41064
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for cfts-solver 0.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.