pydoll-turnstile
pydoll-turnstile solves Cloudflare Turnstile on a pydoll tab by injecting a Peak-solved token, so a protected form or navigation proceeds.
Why
pydoll drives Chrome straight over the DevTools Protocol with no webdriver, which is a big part of why people pick it against Cloudflare. It handles plenty on its own. But the Turnstile widget on a datacenter IP still stalls — the challenge renders, the token never arrives, and the page just sits there.
This reads the sitekey from the DOM, gets a token from Peak, and injects it as the cf-turnstile-response value plus the widget's success callback. When pydoll's own handling leaves you stuck on the widget, drop in a Peak API key and the solve goes through.
Powered by Peak
This package uses Peak to solve Turnstile.
- Solve Cloudflare Turnstile & the 5s challenge in about a second
- $0.90 per 1,000 successful Turnstile solves, down to $0.35 at volume
- 1,000 free solves to start, no card.
→ Get your free API key · Docs · Pricing
Install
pip install pydoll-turnstile pydoll-python
Quickstart
import asyncio
import os
from pydoll.browser import Chrome
from pydoll_turnstile import solve_turnstile
os.environ["PEAK_API_KEY"] = "pk_your_api_key"
async def main():
async with Chrome() as browser:
tab = await browser.start()
await tab.go_to("https://protected.example/login")
# Reads the sitekey, solves via Peak, injects the token.
await solve_turnstile(tab)
# the form / navigation can now proceed
asyncio.run(main())
How it works
- Read the sitekey. An
execute_scriptDOM scan finds thedata-sitekeyon the.cf-turnstilewidget, or the sitekey set through a JSrender()call. - Solve via Peak.
POST https://api.peak.fo/solvewithtask_type: "turnstiletask", the sitekey, and the tab's current URL. The call runs in a worker thread so the event loop stays free. Passproxy=to mint the token from your browser's egress IP. - Inject the token.
execute_scriptsets everycf-turnstile-responsefield, firesinput/change, and calls the widget'sdata-callbackso the form or navigation continues.
API
await solve_turnstile(
tab, # a pydoll tab/page with execute_script
api_key=None, # defaults to env PEAK_API_KEY
proxy=None, # optional http://user:pass@ip:port, forwarded to Peak
sitekey=None, # override auto-detection (e.g. widget in a frame)
url=None, # defaults to the tab's current URL
task_type="turnstiletask",
timeout=180.0,
) -> str # the injected token
read_sitekey(tab), inject_token(tab, token), and current_url(tab) are exposed for finer control. Peak also supports task_type="cloudflare5stask" for the 5s interstitial.
The API key is read from PEAK_API_KEY by default; you can also pass it explicitly. Never hardcode a real key.
Legitimate use
For automation, QA, and scraping public data you are allowed to access. Respect each target's Terms of Service and robots directives, and do not use this for credential-stuffing or other abuse.
License
MIT — see LICENSE.
Metadata
Release files for pydoll-turnstile 0.1.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 | |
|---|---|---|---|
| pydoll_turnstile-0.1.0.tar.gz | 443.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pydoll_turnstile-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 452.0 kB
Release files / pydoll_turnstile-0.1.0.tar.gz
| Download URL | pydoll_turnstile-0.1.0.tar.gz |
|---|---|
| Size | 443.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7edd2f91234e07f3639a9895c6887cd359445f5ace95d7bae8efa95a8d95cc0a
|
|
BLAKE2b-256 checksum How to use checksums |
a87b713c8939b0c3e85281e1abd7105a08cf3261f97b7c775fda42bfbe4a5c30
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.0
|
Release files / pydoll_turnstile-0.1.0-py3-none-any.whl
| Download URL | pydoll_turnstile-0.1.0-py3-none-any.whl |
|---|---|
| Size | 8.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0718ba28c95b88a9e9e0b2a32e98b77e9d66175da02786d1637839a38b8c96ef
|
|
BLAKE2b-256 checksum How to use checksums |
a16c5f978c8d2b299299af19faad16dd054314ee7ffec1430791e5ab2904e7a3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.0
|