ReCaptcha

To import this module:

from python_rucaptcha.re_captcha import ReCaptcha
class python_rucaptcha.re_captcha.ReCaptcha(websiteURL: str, websiteKey: str, minScore: float = 0.3, method: str | ReCaptchaEnm = 'RecaptchaV2TaskProxyless', *args, **kwargs)
__init__(websiteURL: str, websiteKey: str, minScore: float = 0.3, method: str | ReCaptchaEnm = 'RecaptchaV2TaskProxyless', *args, **kwargs)

The class is used to work with ReCaptcha

Parameters:
  • rucaptcha_key – User API key

  • websiteURL (str) – Full URL of the captcha page

  • websiteKey (str) – The value of the data-sitekey parameter you found in the page code

  • versionv3 - indicates that this is reCAPTCHA V3

  • method (str | ReCaptchaEnm) – Captcha type

Examples

>>> ReCaptcha(rucaptcha_key="aa9011f31111181111168611f1151122",
...             websiteURL="https://rucaptcha.com/demo/recaptcha-v2",
...             websiteKey="6LeIxboZAAAAAFQy7d8GPzgRZu2bV0GwKS8ue_cH",
...             method=ReCaptchaEnm.RecaptchaV2TaskProxyless.value
...             ).captcha_handler()
{
   "errorId":0,
   "status":"ready",
   "solution":{
      "gRecaptchaResponse":"03ADUVZw...UWxTAe6ncIa",
      "token":"03ADUVZw...UWxTAe6ncIa"
   },
   "cost":"0.00299",
   "ip":"1.2.3.4",
   "createTime":1692863536,
   "endTime":1692863556,
   "solveCount":1,
   "taskId": 73043008354
}
>>> ReCaptcha(rucaptcha_key="aa9011f31111181111168611f1151122",
...             websiteURL="https://rucaptcha.com/demo/recaptcha-v2",
...             websiteKey="6LeIxboZAAAAAFQy7d8GPzgRZu2bV0GwKS8ue_cH"
...             ).captcha_handler()
{
   "errorId":0,
   "status":"ready",
   "solution":{
      "gRecaptchaResponse":"03ADUVZw...UWxTAe6ncIa",
      "token":"03ADUVZw...UWxTAe6ncIa"
   },
   "cost":"0.00299",
   "ip":"1.2.3.4",
   "createTime":1692863536,
   "endTime":1692863556,
   "solveCount":1,
   "taskId": 73043008354
}
>>> ReCaptcha(rucaptcha_key="aa9011f31111181111168611f1151122",
...             websiteURL="https://rucaptcha.com/demo/recaptcha-v2",
...             websiteKey="6LeIxboZAAAAAFQy7d8GPzgRZu2bV0GwKS8ue_cH",
...             ).captcha_handler()
{
   "errorId":0,
   "status":"ready",
   "solution":{
      "gRecaptchaResponse":"03ADUVZw...UWxTAe6ncIa",
      "token":"03ADUVZw...UWxTAe6ncIa"
   },
   "cost":"0.00299",
   "ip":"1.2.3.4",
   "createTime":1692863536,
   "endTime":1692863556,
   "solveCount":1,
   "taskId": 73043008354
}
>>> ReCaptcha(rucaptcha_key="aa9011f31111181111168611f1151122",
...             websiteURL="https://rucaptcha.com/demo/recaptcha-v2",
...             websiteKey="6LeIxboZAAAAAFQy7d8GPzgRZu2bV0GwKS8ue_cH",
...             method=ReCaptchaEnm.RecaptchaV3TaskProxyless.value,
...             min_score=0.3,
...             ).captcha_handler()
{
   "errorId":0,
   "status":"ready",
   "solution":{
      "gRecaptchaResponse":"03ADUVZw...UWxTAe6ncIa",
      "token":"03ADUVZw...UWxTAe6ncIa"
   },
   "cost":"0.00299",
   "ip":"1.2.3.4",
   "createTime":1692863536,
   "endTime":1692863556,
   "solveCount":1,
   "taskId": 73043008354
}
>>> await ReCaptcha(rucaptcha_key="aa9011f31111181111168611f1151122",
...             websiteURL="https://rucaptcha.com/demo/recaptcha-v2",
...             websiteKey="6LeIxboZAAAAAFQy7d8GPzgRZu2bV0GwKS8ue_cH",
...             method=ReCaptchaEnm.RecaptchaV2TaskProxyless.value
...             ).aio_captcha_handler()
{
   "errorId":0,
   "status":"ready",
   "solution":{
      "gRecaptchaResponse":"03ADUVZw...UWxTAe6ncIa",
      "token":"03ADUVZw...UWxTAe6ncIa"
   },
   "cost":"0.00299",
   "ip":"1.2.3.4",
   "createTime":1692863536,
   "endTime":1692863556,
   "solveCount":1,
   "taskId": 73043008354
}
Returns:

Dict with full server response

captcha_handler(**kwargs) dict

Sync solving method

Parameters:

kwargs – additional params for requests library

Returns:

Dict with full server response

Return type:

dict

Notes

Check class docstirng for more info

async aio_captcha_handler() dict

Async solving method

Returns:

Dict with full server response

Return type:

dict

Notes

Check class docstirng for more info