TextCaptcha

To import this module:

from python_rucaptcha.text_captcha import TextCaptcha
class python_rucaptcha.text_captcha.TextCaptcha(languagePool: str = 'en', *args, **kwargs)
__init__(languagePool: str = 'en', *args, **kwargs)

The class is used to work with Text Captcha.

Parameters:
  • rucaptcha_key – User API key

  • languagePool (str) –

    Used to choose the workers for solving the captcha by their language. Applicable to image-based and text-based captchas.

    en - English-speaking workers

    rn - Russian-speaking workers.

  • kwargs – Additional not required params for this captcha type

Examples

>>> TextCaptcha(rucaptcha_key="aa90...51122",
...             languagePool='en'
...             ).captcha_handler(textcaptcha="If tomorrow is Saturday, what day is today?")
{
   "errorId":0,
   "status":"ready",
   "solution":{
      "text":"SUNDAY"
   },
   "cost":0.03669,
   "ip":"46.53.241.91",
   "createTime":1695617910,
   "endTime":1695617965,
   "solveCount":2,
   "taskId":5423543
}
>>> TextCaptcha(rucaptcha_key="aa90...51122",
...             ).captcha_handler(textcaptcha="If tomorrow is Saturday, what day is today?")
{
   "errorId":0,
   "status":"ready",
   "solution":{
      "text":"SUNDAY"
   },
   "cost":0.03669,
   "ip":"46.53.241.91",
   "createTime":1695617910,
   "endTime":1695617965,
   "solveCount":2,
   "taskId":5423543
}
>>> await TextCaptcha(rucaptcha_key="aa90...51122",
...             ).aio_captcha_handler(textcaptcha="If tomorrow is Saturday, what day is today?")
{
   "errorId":0,
   "status":"ready",
   "solution":{
      "text":"SUNDAY"
   },
   "cost":0.03669,
   "ip":"46.53.241.91",
   "createTime":1695617910,
   "endTime":1695617965,
   "solveCount":2,
   "taskId":5423543
}
Returns:

Dict with full server response

captcha_handler(textcaptcha: str, **kwargs) dict

Synchronous method for captcha solving

Parameters:

textcaptcha (str) – Captcha text

Returns:

Dict with full server response

Return type:

dict

Notes

Check class docstirng for more info

async aio_captcha_handler(textcaptcha: str) dict

Asynchronous method for captcha solving

Parameters:

textcaptcha (str) – Captcha text

Returns:

Dict with full server response

Return type:

dict

Notes

Check class docstirng for more info