Cloudflare¶
To import this module:
from python3_capsolver.cloudflare import Cloudflare
- class python3_capsolver.cloudflare.Cloudflare(captcha_type: CloudflareTypeEnm | str, websiteURL: str, websiteKey: str | None = None, *args, **kwargs)¶
The class is used to work with Capsolver Cloudflare methods.
- Parameters:
api_key – Capsolver API key
captcha_type (CloudflareTypeEnm | str) – Captcha type name, like
ReCaptchaV2Task
and etc.websiteURL (str) – Address of a webpage with Google ReCaptcha
websiteKey (str | None) – Recaptcha website key. <div class=”g-recaptcha” data-sitekey=”THAT_ONE”></div>
metadata – Extra data
html – You can pass in the entire html source code for the challenge directly.
Examples
>>> Cloudflare(api_key="CAI-1324...", ... captcha_type=CloudflareTypeEnm.AntiCloudflareTask, ... websiteURL="https://bck.websiteurl.com/registry", ... websiteKey='0x4AAAAAAABS7vwvV6VFfMcD', ... proxy="socks5:158.120.100.23:334:user:pass" ... ).captcha_handler() CaptchaResponseSer(errorId=0, errorCode=None, errorDescription=None, taskId='73bdcd28-6c77-4414-8....', status=<ResponseStatusEnm.Ready: 'ready'>, solution={'token': '44795sds...'} )
>>> Cloudflare(api_key="CAI-1324...", ... captcha_type=CloudflareTypeEnm.AntiCloudflareTask, ... websiteURL="https://bck.websiteurl.com/registry", ... proxy="socks5:158.120.100.23:334:user:pass" ... ).captcha_handler() CaptchaResponseSer(errorId=0, errorCode=None, errorDescription=None, taskId='73bdcd28-6c77-4414-8....', status=<ResponseStatusEnm.Ready: 'ready'>, solution={'token': '44795sds...'} )
>>> await Cloudflare(api_key="CAI-1324...", ... captcha_type=CloudflareTypeEnm.AntiCloudflareTask, ... websiteURL="https://bck.websiteurl.com/registry", ... websiteKey='0x4AAAAAAABS7vwvV6VFfMcD', ... proxy="socks5:158.120.100.23:334:user:pass" ... ).aio_captcha_handler() CaptchaResponseSer(errorId=0, errorCode=None, errorDescription=None, taskId='73bdcd28-6c77-4414-8....', status=<ResponseStatusEnm.Ready: 'ready'>, solution={'token': '44795sds...'} )
- Returns:
CaptchaResponseSer model with full server response
Notes
https://docs.capsolver.com/guide/antibots/cloudflare_turnstile.html https://docs.capsolver.com/guide/antibots/cloudflare_challenge.html
- captcha_handler() CaptchaResponseSer ¶
Sync method for captcha solving
- Returns:
CaptchaResponseSer model with full service response
- Return type:
CaptchaResponseSer
Notes
Check class docstring for more info
- async aio_captcha_handler() CaptchaResponseSer ¶
Async method for captcha solving
- Returns:
CaptchaResponseSer model with full service response
- Return type:
CaptchaResponseSer
Notes
Check class docstring for more info