Skip to main content

Cloudflare Turnstile Solver

PyPI CI

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

MIT License

Metadata

Release files for cfts-solver 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cfts-solver 0.0.1
File Size Uploaded Provenance Actions
cfts_solver-0.0.1.tar.gz 17.0 kB Without provenance Details for cfts_solver-0.0.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for cfts-solver 0.0.1
File Interpreter ABI Platform Actions
cfts_solver-0.0.1-py3-none-any.whl Python 3 none any Details for cfts_solver-0.0.1-py3-none-any.whl

Total release size: 37.5 kB

Release files / cfts_solver-0.0.1.tar.gz

Download URL cfts_solver-0.0.1.tar.gz
Size 17.0 kB
Tags Source
SHA-256 checksum
How to use checksums
a8ee59819e1eb3140262177ab3734eda6d46d1484529476c65749e2a905b976c
BLAKE2b-256 checksum
How to use checksums
a7a792fbdec7519d2e7d99331ceee845a04240ff709034cfd1a0dad4fad5fdb1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.5 {"installer":{"name":"uv","version":"0.13.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","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.1-py3-none-any.whl

Download URL cfts_solver-0.0.1-py3-none-any.whl
Size 20.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
82a503f6581abef9d5de71920aa80ae1e7558337833f8d7c6114a7de9c0ace97
BLAKE2b-256 checksum
How to use checksums
f773fa98edf0ea7e8648115cc7ade50fc39249ebbbb04b537cd7328e27911587
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.5 {"installer":{"name":"uv","version":"0.13.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","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.1

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.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.0.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page