MTCaptcha

To import this module:

from python_rucaptcha.mt_captcha import MTCaptcha
class python_rucaptcha.mt_captcha.MTCaptcha(websiteURL: str, websiteKey: str, method: str | MTCaptchaEnm = 'MtCaptchaTaskProxyless', *args, **kwargs)
__init__(websiteURL: str, websiteKey: str, method: str | MTCaptchaEnm = 'MtCaptchaTaskProxyless', *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 MTCaptcha sitekey value found in the page code.

  • method (str | MTCaptchaEnm) – Captcha type

  • kwargs – Not required params for task creation request

Examples

>>> MTCaptcha(rucaptcha_key="aa9011f31111181111168611f1151122",
...             websiteURL="https://service.mtcaptcha.com/mtcv1/demo/index.html",
...             websiteKey="MTPublic-DemoKey9M",
...             method=MTCaptchaEnm.MtCaptchaTaskProxyless,
...             ).captcha_handler()
{
   "errorId":0,
   "status":"ready",
   "solution":{
        "token": "datadome=4ZXwCBlyHx9ktZhSnycMF...; Path=/; Secure; SameSite=Lax"
   },
   "cost":"0.00299",
   "ip":"1.2.3.4",
   "createTime":1692863536,
   "endTime":1692863556,
   "solveCount":1,
   "taskId": 73243152973,
}
>>> await MTCaptcha(rucaptcha_key="aa9011f31111181111168611f1151122",
...             websiteURL="https://service.mtcaptcha.com/mtcv1/demo/index.html",
...             websiteKey="MTPublic-DemoKey9M",
...             method=MTCaptchaEnm.MtCaptchaTaskProxyless,
...             ).aio_captcha_handler()
{
   "errorId":0,
   "status":"ready",
   "solution":{
        "token": "datadome=4ZXwCBlyHx9ktZhSnycMF...; Path=/; Secure; SameSite=Lax"
   },
   "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