Solve Cloudflare Turnstile in pydoll via the Peak API: read the sitekey, get a token, inject it. Async.
pip install pydoll-turnstile==0.1.1
pydoll-turnstile solves Cloudflare Turnstile on a pydoll tab. It reads the sitekey, gets a token from Peak, and writes it into the widget so the protected form or proceeds.
pydoll drives Chrome over the DevTools Protocol with no webdriver, and it ships its own Turnstile helper, tab.expect_cloudflare_turnstile() , which clicks the checkbox for you. On a clean residential IP that click is often enough.
On a datacenter IP it often isn't. The challenge renders, the click lands, and no token arrives, because Cloudflare scores the IP and the session before it scores the click. For those pages this package asks Peak for a token and injects it as the cf-turnstile-response value, then calls the widget's success callback.
This package uses Peak to solve Turnstile.
$0.90 per 1,000 successful Turnstile solves, down to $0.35 at volume
A failed solve is not billed
1,000 free solves to start, no card
→ Get your free API key · Docs · Pricing
Use 0.1.1 or later. Version 0.1.0 does not work with pydoll (see Troubleshooting).
Read the sitekey. An execute_script DOM scan finds the data-sitekey attribute, or a 0x... sitekey set through a JS render() call in the page source.
Solve via Peak. POST with task_type: "turnstiletask" , the sitekey, and the tab's current URL. The call runs in a worker thread so the event loop stays free. Pass proxy= to mint the token from your browser's egress IP.
Inject the token. execute_script sets every cf-turnstile-response field, fires input / change , and calls the function named in the widget's data-callback attribute.
read_sitekey(tab) , inject_token(tab, token) , and current_url(tab) are exposed for finer control. inject_token returns True when it found and called a data-callback function, and False when it only filled the field.
The API key is read from PEAK_API_KEY by default; you can also pass it explicitly. Never hardcode a real key.
Every failure raises PeakError with a string you can grep for. The last three cases raise nothing.
Every solve fails on 0.1.0. pydoll's execute_script returns the whole CDP response ( {"id": ..., "result": {"result": {"value": ...}}} ). Version 0.1.0 unwrapped one level too few and sent that dictionary to Peak as the sitekey and the URL. 0.1.1 fixes the unwrap; it was checked against pydoll 3.0.1 on a live Chrome. Run pip install -U pydoll-turnstile .
PeakError: No Turnstile sitekey found on the page. The call ran before the widget rendered, or the widget sits in a frame or a closed shadow root the DOM scan can't see. Wait for the challenges.cloudflare.com iframe first, or pass sitekey= . How to find a Cloudflare Turnstile sitekey shows where sites hide it.
PeakError: No Peak API key. Neither api_key= nor PEAK_API_KEY held a key. Keys start with pk_ ; the free one comes from the dashboard .
PeakError: Peak request failed: ... The HTTPS call to api.peak.fo failed on your side: DNS, TLS, a firewall, or the timeout= . The proxy= argument is forwarded to Peak for the solve and is not used for this call. urllib does honour an HTTPS_PROXY variable in the environment.
PeakError: followed by Peak's own reason, or Peak solve failed . Peak answered with success: false . The usual causes are an unknown key, an empty balance, a sitekey that does not belong to the page URL, or a proxy= Peak could not connect through. The Cloudflare Turnstile error codes post covers the widget-side codes (110200, 300030, 600010 and the rest).
The token came back and the form still does nothing. inject_token returned False : the field is filled, but the site passed a closure to turnstile.render({callback: ...}) , and a closure has no global name to call. Submit the form yourself with pydoll, or call the site's handler with the token through tab.execute_script . cf-turnstile-response is empty and the cf-turnstile-response token explained cover the field.
The submit returns 403 or the form page again. The site refused the token. A token works once and expires 300 seconds after Cloudflare issues it. Pass proxy= with the browser's own egress so Peak mints the token from the address that submits it. Cloudflare Turnstile 403 walks through the refusal.
The page shows "Just a moment..." and has no widget. That page is the managed 5-second challenge, a separate check from the Turnstile widget. It wants a cf_clearance cookie, and this package injects widget tokens. Turnstile token vs cookie explains the difference, and the Cloudflare 5-second challenge explained covers the interstitial.
Two longer reads: How to scrape Cloudflare-protected sites without getting blocked and the 2026 Turnstile developer guide .
Other CDP and browser wrappers for the same API: nodriver-turnstile · drissionpage-turnstile · patchright-turnstile · playwright-turnstile · camoufox-turnstile · selenium-turnstile · botasaurus-turnstile · puppeteer-extra-plugin-turnstile · crawlee-turnstile . No browser: cloudscraper-turnstile · turnstile-curl · scrapy-turnstile · scrapling-turnstile . Agents: browser-use-turnstile · crewai-turnstile · langchain-turnstile . Full list in awesome-turnstile-solvers .
cloudflare-turnstile-reversed documents the challenge flow, the widget parameters and the fingerprinting the widget runs before it hands out a token.
Release files for pydoll-turnstile 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation .
Source distribution (sdist)
Built distribution (wheel)
Total release size: 457.1 kB
Release files / pydoll_turnstile-0.1.1.tar.gz
Release files / pydoll_turnstile-0.1.1-py3-none-any.whl
Security for pydoll-turnstile 0.1.1
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.
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.
Release history Release notifications | RSS feed
Nov 30, 2026 2 release files No provenance
Oct 9, 2026 2 release files No provenance
