ReCaptchaV3¶
To import this module:
from python3_anticaptcha.recaptcha_v3 import ReCaptchaV3
- class python3_anticaptcha.recaptcha_v3.ReCaptchaV3(api_key: str, websiteURL: str, websiteKey: str, minScore: float, pageAction: str | None = None, isEnterprise: bool = False, apiDomain: str | None = None, captcha_type: CaptchaTypeEnm = CaptchaTypeEnm.RecaptchaV3TaskProxyless, sleep_time: int = 10)¶
- __init__(api_key: str, websiteURL: str, websiteKey: str, minScore: float, pageAction: str | None = None, isEnterprise: bool = False, apiDomain: str | None = None, captcha_type: CaptchaTypeEnm = CaptchaTypeEnm.RecaptchaV3TaskProxyless, sleep_time: int = 10)¶
The class is used to work with ReCaptchaV3 and RecaptchaV3Enterprise.
- Parameters:
api_key (str) – Capsolver API key
captcha_type (CaptchaTypeEnm) – Captcha type
websiteURL (str) – Address of the webpage
websiteKey (str) – Recaptcha website key.
minScore (float) – Filters workers with a particular score. It can have one of the following values: 0.3, 0.7, 0.9
pageAction (str | None) – Recaptcha’s “action” value Website owners use this parameter to define what users are doing on the page.
isEnterprise (bool) – Set this flag to “true” if you need this V3 solved with Enterprise API. Default value is “false” and the reCaptcha is solved with non-enterprise API.
apiDomain (str | None) – Use this parameter to send the domain name from which the reCaptcha script should be served. Can have only one of two values: “www.google.com” or “www.recaptcha.net”. Do not use this parameter unless you understand what you are doing.
sleep_time (int) – The waiting time between requests to get the result of the Captcha
Examples
>>> ReCaptchaV3(api_key="99d7d111a0111dc11184111c8bb111da", ... captcha_type=CaptchaTypeEnm.RecaptchaV3TaskProxyless, ... websiteURL="https://www.recaptcha.com/en/adaptive-captcha-demo", ... websiteKey="6Lc_aCMTAAAAABx7u2N0D1XnVbI_v6ZdbM6rYf16", ... minScore=0.3, ... pageAction="login", ... isEnterprise=False, ... ).captcha_handler() { "errorId": 0, "errorCode": None, "errorDescription": None, "status":"ready", "solution":{ "gRecaptchaResponse":"3AHJ_VuvYIB.......6a3" }, "cost": 0.002, "ip": "46.53.249.230", "createTime": 1679004358, "endTime": 1679004368, "solveCount": 0, "taskId": 396687629 }
>>> await ReCaptchaV3(api_key="99d7d111a0111dc11184111c8bb111da", ... captcha_type=CaptchaTypeEnm.RecaptchaV3TaskProxyless, ... websiteURL="https://www.recaptcha.com/en/adaptive-captcha-demo", ... websiteKey="6Lc_aCMTAAAAABx7u2N0D1XnVbI_v6ZdbM6rYf16", ... minScore=0.3, ... pageAction="login", ... isEnterprise=True, ... ).aio_captcha_handler() { "errorId": 0, "errorCode": None, "errorDescription": None, "status":"ready", "solution":{ "gRecaptchaResponse":"3AHJ_VuvYIB.......6a3" }, "cost": 0.002, "ip": "46.53.249.230", "createTime": 1679004358, "endTime": 1679004368, "solveCount": 0, "taskId": 396687629 }
>>> ReCaptchaV3(api_key="99d7d111a0111dc11184111c8bb111da", ... captcha_type=CaptchaTypeEnm.RecaptchaV3TaskProxyless, ... websiteURL="https://www.recaptcha.com/en/adaptive-captcha-demo", ... websiteKey="6Lc_aCMTAAAAABx7u2N0D1XnVbI_v6ZdbM6rYf16", ... minScore=0.3, ... pageAction="login", ... isEnterprise=True, ... ).captcha_handler() { "errorId": 0, "errorCode": None, "errorDescription": None, "status":"ready", "solution":{ "gRecaptchaResponse":"3AHJ_VuvYIB.......6a3" }, "cost": 0.002, "ip": "46.53.249.230", "createTime": 1679004358, "endTime": 1679004368, "solveCount": 0, "taskId": 396687629 }
- async aio_captcha_handler(**additional_params) dict ¶
Asynchronous method for captcha solving
- Parameters:
additional_params – Some additional parameters that will be used in creating the task and will be passed to the payload under
task
key. LikeproxyLogin
,proxyPassword
and etc. - more info in service docs- Returns:
Dict with full server response
- Return type:
dict
Notes
Check class docstirng for more info
- captcha_handler(**additional_params) dict ¶
Synchronous method for captcha solving
- Parameters:
additional_params – Some additional parameters that will be used in creating the task and will be passed to the payload under
task
key. LikeproxyLogin
,proxyPassword
and etc. - more info in service docs- Returns:
Dict with full server response
- Return type:
dict
Notes
Check class docstirng for more info
- set_callback_url(callbackUrl: str) None ¶
Method for callbackUrl param set.
- Parameters:
callbackUrl (str) –
Optional web address where we can send the results of captcha task processing. Contents are sent by AJAX POST request and are identical
to the contents of getTaskResult method.