ReCaptcha¶
To import this module:
from python3_capsolver.recaptcha import ReCaptcha
- class python3_capsolver.recaptcha.ReCaptcha(captcha_type: ReCaptchaV2TypeEnm | ReCaptchaV3TypeEnm | str, websiteURL: str, websiteKey: str, pageAction: str | None = None, *args, **kwargs)¶
The class is used to work with Capsolver ReCaptcha methods.
- Parameters:
api_key – Capsolver API key
captcha_type (ReCaptchaV2TypeEnm | ReCaptchaV3TypeEnm | str) – Captcha type name, like
ReCaptchaV2Task
and etc.websiteURL (str) – Address of a webpage with Google ReCaptcha
websiteKey (str) – Recaptcha website key. <div class=”g-recaptcha” data-sitekey=”THAT_ONE”></div>
pageAction (str | None) – Widget action value. Website owner defines what user is doing on the page through this parameter. Default value:
verify
. Example: grecaptcha.execute(‘site_key’, {action:’login_test’}).
Examples
>>> ReCaptcha(api_key="CAI-1324...", ... captcha_type="ReCaptchaV2TaskProxyLess", ... websiteURL="https://www.google.com/recaptcha/api2/demo", ... websiteKey="6Le-wvkSAAAAAPBMRTvw0Q4Muexq9bi0DJwx_mJ-" ... ).captcha_handler() CaptchaResponseSer(errorId=0, errorCode=None, errorDescription=None, taskId='73bdcd28-6c77-4414-8....', status=<ResponseStatusEnm.Ready: 'ready'>, solution={'gRecaptchaResponse': '44795sds...'} )
>>> ReCaptcha(api_key="CAI-1324...", ... captcha_type=ReCaptchaV2TypeEnm.ReCaptchaV2TaskProxyLess, ... websiteURL="https://www.google.com/recaptcha/api2/demo", ... websiteKey="6Le-wvkSAAAAAPBMRTvw0Q4Muexq9bi0DJwx_mJ-" ... ).captcha_handler() CaptchaResponseSer(errorId=0, errorCode=None, errorDescription=None, taskId='73bdcd28-6c77-4414-8....', status=<ResponseStatusEnm.Ready: 'ready'>, solution={'gRecaptchaResponse': '44795sds...'} )
>>> ReCaptcha(api_key="CAI-1324...", ... captcha_type=ReCaptchaV2TypeEnm.ReCaptchaV2Task, ... websiteURL="https://www.google.com/recaptcha/api2/demo", ... websiteKey="6Le-wvkSAAAAAPBMRTvw0Q4Muexq9bi0DJwx_mJ-", ... proxy="socks5:192.191.100.10:4780:user:pwd" ... ).captcha_handler() CaptchaResponseSer(errorId=0, errorCode=None, errorDescription=None, taskId='73bdcd28-6c77-4414-8....', status=<ResponseStatusEnm.Ready: 'ready'>, solution={'gRecaptchaResponse': '44795sds...'} )
>>> ReCaptcha(api_key="CAI-1324...", ... captcha_type=ReCaptchaV3TypeEnm.ReCaptchaV3TaskProxyLess, ... websiteURL="https://2captcha.com/demo/recaptcha-v3", ... websiteKey="6LfB5_IbAAAAAMCtsjEHEHKqcB9iQocwwxTiihJu", ... pageAction="demo_action", ... proxy="socks5:192.191.100.10:4780:user:pwd" ... ).captcha_handler() CaptchaResponseSer(errorId=0, errorCode=None, errorDescription=None, taskId='73bdcd28-6c77-4414-8....', status=<ResponseStatusEnm.Ready: 'ready'>, solution={'gRecaptchaResponse': '44795sds...'} )
>>> await ReCaptcha(api_key="CAI-1324...", ... captcha_type=ReCaptchaV3TypeEnm.ReCaptchaV3TaskProxyLess, ... websiteURL="https://2captcha.com/demo/recaptcha-v3", ... websiteKey="6LfB5_IbAAAAAMCtsjEHEHKqcB9iQocwwxTiihJu", ... pageAction="demo_action", ... proxy="socks5:192.191.100.10:4780:user:pwd" ... ).aio_captcha_handler() CaptchaResponseSer(errorId=0, errorCode=None, errorDescription=None, taskId='73bdcd28-6c77-4414-8....', status=<ResponseStatusEnm.Ready: 'ready'>, solution={'gRecaptchaResponse': '44795sds...'} )
- Returns:
CaptchaResponseSer model with full server response
Notes
https://docs.capsolver.com/guide/captcha/ReCaptchaV2.html https://docs.capsolver.com/guide/captcha/ReCaptchaV3.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