Add support for Cloudflare Turnstile CAPTCHA solving#134
Open
Conversation
Add TurnstileTaskProxyless and TurnstileTask classes for solving Cloudflare Turnstile challenges, with optional action, cData, and chlPageData parameters. Includes sync/async examples, unit tests, and documentation updates. https://claude.ai/code/session_01KKZjR7gkNfk4vUhJb1eJr6
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds support for solving Cloudflare Turnstile CAPTCHA challenges to the python-anticaptcha library. Two new task classes are introduced to handle both proxy-less and proxy-based solving approaches.
Key Changes
New Task Classes: Added
TurnstileTaskProxylessandTurnstileTaskclassesTurnstileTaskProxyless: Solves Turnstile without a proxy, requiring only website URL and site keyTurnstileTask: Extends the proxyless version with proxy, user-agent, and cookie support for proxy-based solvingOptional Parameters: Both classes support optional Turnstile-specific parameters:
action: Action parameter passed to the Turnstile widgetcdata: cData token for Cloudflare-protected pageschl_page_data: chlPageData token for Cloudflare pagesDocumentation & Examples:
sync_turnstile_request.py: Synchronous proxyless examplesync_turnstile_request_proxy.py: Synchronous proxy-based exampleasync_turnstile_request.py: Asynchronous proxyless exampleAPI Exports: Updated
__init__.pyto export the new task classesTest Coverage: Added comprehensive test cases for both task classes covering required fields, optional fields, and proxy integration
Implementation Details
TurnstileTaskProxylessfollows the existing pattern of other proxyless task classes (e.g.,RecaptchaV3TaskProxyless)TurnstileTaskuses multiple inheritance withProxyMixin,UserAgentMixin, andCookieMixinto reuse proxy handling logichttps://claude.ai/code/session_01KKZjR7gkNfk4vUhJb1eJr6