HCaptcha

To import this module:

from python_rucaptcha.hcaptcha import HCaptcha
class python_rucaptcha.hcaptcha.HCaptcha(websiteURL: str, websiteKey: str, method: str | HCaptchaEnm = HCaptchaEnm.HCaptchaTaskProxyless, *args, **kwargs)
__init__(websiteURL: str, websiteKey: str, method: str | HCaptchaEnm = HCaptchaEnm.HCaptchaTaskProxyless, *args, **kwargs)

The class is used to work with HCaptcha.

Parameters:
  • rucaptcha_key – User API key

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

  • websiteKey (str) – The value of the data-sitekey parameter found on the site

  • method (str | HCaptchaEnm) – Captcha type

  • kwargs – Not required params for task creation request

Examples

>>> HCaptcha(rucaptcha_key="aa9011f31111181111168611f1151122",
...             websiteKey="3ceb8624-1970-4e6b-91d5-70317b70b651",
...             websiteURL="https://rucaptcha.com/demo/hcaptcha",
...             method=HCaptchaEnm.HCaptchaTaskProxyless.value
...             ).captcha_handler()
{
   "errorId":0,
   "status":"ready",
   "solution":{
      "token":"P1_eyJ0eXAiOiJKV...1LDq89KyJ5A",
      "respKey":"E0_eyJ0eXAiOiJK...y2w5_YbP8PGuJBBo",
      "userAgent":"Mozilla/5.0 (.......",
      "gRecaptchaResponse":"P1_eyJ0eXAiOiJKV...1LDq89KyJ5A"
   },
   "cost":"0.00299",
   "ip":"1.2.3.4",
   "createTime":1692863536,
   "endTime":1692863556,
   "solveCount":1,
   "taskId": 73243152973,
}
>>> await HCaptcha(rucaptcha_key="aa9011f31111181111168611f1151122",
...             websiteKey="3ceb8624-1970-4e6b-91d5-70317b70b651",
...             websiteURL="https://rucaptcha.com/demo/hcaptcha",
...             method=HCaptchaEnm.HCaptchaTaskProxyless.value
...             ).aio_captcha_handler()
{
   "errorId":0,
   "status":"ready",
   "solution":{
      "token":"P1_eyJ0eXAiOiJKV...1LDq89KyJ5A",
      "respKey":"E0_eyJ0eXAiOiJK...y2w5_YbP8PGuJBBo",
      "userAgent":"Mozilla/5.0 (........",
      "gRecaptchaResponse":"P1_eyJ0eXAiOiJKV...1LDq89KyJ5A"
   },
   "cost":"0.00299",
   "ip":"1.2.3.4",
   "createTime":1692863536,
   "endTime":1692863556,
   "solveCount":1,
   "taskId": 73243152973,
}
Returns:

Dict with full server response

captcha_handler(**kwargs) dict

Sync solving method

Parameters:

kwargs – Parameters for the 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