Skip to main content
Peak — solve Cloudflare Turnstile & the 5s challenge in ~1s

botasaurus-turnstile

botasaurus-turnstile solves Cloudflare Turnstile on a Botasaurus driver by injecting a Peak-solved token, so a protected form or navigation proceeds.

Why

Botasaurus drives an anti-detect Chrome and ships a lot of Cloudflare handling, which is why people run it against protected sites. The interstitial often clears. The Turnstile widget on a datacenter IP is the part that doesn't — it renders, waits for a click or a token that never comes, and the run stalls.

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 the driver gets you to the page but the widget won't clear, drop in a Peak API key and it 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 botasaurus-turnstile botasaurus-driver

Quickstart

import os
from botasaurus.browser import browser, Driver
from botasaurus_turnstile import solve_turnstile

os.environ["PEAK_API_KEY"] = "pk_your_api_key"


@browser
def scrape(driver: Driver, data):
    driver.get("https://protected.example/login")

    # Reads the sitekey from the page, solves via Peak, injects the token.
    solve_turnstile(driver)

    # the form / navigation can now proceed


scrape()

Works the same with a standalone botasaurus_driver.Driver() — anything that exposes run_js and current_url.

How it works

  1. Read the sitekey. A run_js DOM scan finds the data-sitekey on the .cf-turnstile widget, or the sitekey set through a JS render() call.
  2. Solve via Peak. POST https://api.peak.fo/solve with task_type: "turnstiletask", the sitekey, and the driver's current URL. Pass proxy= to mint the token from your browser's egress IP.
  3. Inject the token. run_js sets every cf-turnstile-response field, fires input/change, and calls the widget's data-callback so the form or navigation continues.

API

solve_turnstile(
    driver,               # a Botasaurus Driver
    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 driver.current_url
    task_type="turnstiletask",
    timeout=180.0,
) -> str                  # the injected token

read_sitekey(driver) and inject_token(driver, token) 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 botasaurus-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)

Source distribution for botasaurus-turnstile 0.1.0
File Size Uploaded
botasaurus_turnstile-0.1.0.tar.gz 443.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for botasaurus-turnstile 0.1.0
File Interpreter ABI Platform
botasaurus_turnstile-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 451.2 kB

Release files / botasaurus_turnstile-0.1.0.tar.gz

Download URL botasaurus_turnstile-0.1.0.tar.gz
Size 443.5 kB
Tags Source
SHA-256 checksum
How to use checksums
20672a0baac399c482b49f3e7c622905cb4a134ddc32d7b285def36d087fbf70
BLAKE2b-256 checksum
How to use checksums
d8f50514f7b3e8ad6bc7362b07f9eb024f8236652e4795cf62412b6b3057f1f3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.0

Release files / botasaurus_turnstile-0.1.0-py3-none-any.whl

Download URL botasaurus_turnstile-0.1.0-py3-none-any.whl
Size 7.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5e7e7f14ad86b63f5d3baf968a29de2479baa3c32cc18bc8def413886e07b466
BLAKE2b-256 checksum
How to use checksums
052b2019c639eefef324e279452d98c6a15290faed8bc740e06cba0bae48bbd2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.0

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

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