Skip to content

Add Peak API solver for Cloudflare Turnstile - #16

Open
CircuitSavage wants to merge 2 commits into
techinz:mainfrom
CircuitSavage:add-peak-solver
Open

Add Peak API solver for Cloudflare Turnstile#16
CircuitSavage wants to merge 2 commits into
techinz:mainfrom
CircuitSavage:add-peak-solver

Conversation

@CircuitSavage

Copy link
Copy Markdown

What this adds

A new API solver, Peak (peak.fo), for Cloudflare Turnstile. It slots in next to the existing TwoCaptchaSolver and TenCaptchaSolver and uses the same ApiSolverBase flow, so usage looks identical to the current API solvers.

from playwright_captcha import CaptchaType, PeakSolver, FrameworkType
from playwright_captcha.solvers.api.peak.peak_client import AsyncPeakClient

async with PeakSolver(
        framework=FrameworkType.PLAYWRIGHT,
        page=page,
        async_peak_client=AsyncPeakClient(PEAK_API_KEY)) as solver:
    await solver.solve_captcha(
        captcha_container=turnstile_container,
        captcha_type=CaptchaType.CLOUDFLARE_TURNSTILE,
        proxy=PEAK_PROXY,
    )

Why it might be useful here

Peak returns the token in a single request instead of the submit-then-poll loop, and it charges only for solves that succeed. For people already using this library's API-solver path, it's one more provider to choose from.

Changes

  • solvers/api/peak/peak_client.py — small httpx client for the /solve and /balance endpoints
  • solvers/api/peak/peak_solver.pyPeakSolver(ApiSolverBase), mirrors TwoCaptchaSolver (detect → solve → apply)
  • types/solvers.py — adds SolverType.peak
  • captchas/cloudflare_turnstile/__init__.py — registers the solver for Turnstile
  • playwright_captcha/__init__.py — exports PeakSolver
  • examples/cloudflare/peak_turnstile.py — runnable example
  • README.md — entry under the API Solver section

Notes

  • No new dependencies (httpx is already used across the project).
  • Scope is Cloudflare Turnstile only, matching where the other API solvers start.
  • Happy to adjust naming, the client, or the docs to fit your conventions.

Adds Peak (peak.fo) as an API solver option, following the same
pattern as the existing TwoCaptcha and TenCaptcha solvers:

- AsyncPeakClient: minimal httpx client for the Peak /solve and
  /balance endpoints
- PeakSolver(ApiSolverBase): detect -> solve -> apply flow, mirrors
  TwoCaptchaSolver
- SolverType.peak enum member and registration for Cloudflare Turnstile
- Example at examples/cloudflare/peak_turnstile.py
- README entry under the API Solver section

Peak returns the token in a single request (no submit-then-poll) and
charges only for successful solves.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant