CutCaptcha

To import this module:

from python_rucaptcha.cutcaptcha import CutCaptcha
class python_rucaptcha.cutcaptcha.CutCaptcha(websiteURL: str, miseryKey: str, apiKey: str, method: str | CutCaptchaEnm = CutCaptchaEnm.CutCaptchaTaskProxyless, *args, **kwargs)
__init__(websiteURL: str, miseryKey: str, apiKey: str, method: str | CutCaptchaEnm = CutCaptchaEnm.CutCaptchaTaskProxyless, *args, **kwargs)

The class is used to work with CutCaptcha.

Parameters:
  • rucaptcha_key – User API key

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

  • miseryKey (str) – The value of CUTCAPTCHA_MISERY_KEY variable defined on page.

  • apiKey (str) – The value of data-apikey attribute of iframe’s body. Also the name of javascript file included on the page

  • method (str | CutCaptchaEnm) – Captcha type

  • kwargs – Not required params for task creation request

Examples

>>> CutCaptcha(rucaptcha_key="aa9011f31111181111168611f1151122",
...             websiteURL="https://example.cc/foo/bar.html",
...             miseryKey="a1488b66da00bf332a1488993a5443c79047e752",
...             apiKey="SAb83IIB",
...             method=CutCaptchaEnm.CutCaptchaTaskProxyless
...             ).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 CutCaptcha(rucaptcha_key="aa9011f31111181111168611f1151122",
...             websiteURL="https://example.cc/foo/bar.html",
...             miseryKey="a1488b66da00bf332a1488993a5443c79047e752",
...             apiKey="SAb83IIB",
...             method=CutCaptchaEnm.CutCaptchaTaskProxyless
...             ).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