RotateCaptcha

To import this module:

from python_rucaptcha.rotate_captcha import RotateCaptcha
class python_rucaptcha.rotate_captcha.RotateCaptcha(save_format: str | SaveFormatsEnm = SaveFormatsEnm.TEMP, img_clearing: bool = True, img_path: str = 'PythonRotateCaptchaFiles', *args, **kwargs)
__init__(save_format: str | SaveFormatsEnm = SaveFormatsEnm.TEMP, img_clearing: bool = True, img_path: str = 'PythonRotateCaptchaFiles', *args, **kwargs)

The class is used to work with Rotate Captcha.

Parameters:
  • method – Captcha type

  • kwargs – Not required params for task creation request

Examples

>>> RotateCaptcha(rucaptcha_key="aa9011f31111181111168611f1151122",
...             ).captcha_handler(captcha_file="examples/rotate/rotate_ex.png")
{
   "errorId":0,
   "status":"ready",
   "solution":{
      "rotate":180
   },
   "cost":"0.0005",
   "ip":"1.2.3.4",
   "createTime":1692863536,
   "endTime":1692863556,
   "solveCount":1,
   "taskId": 73043008354
}
>>> with open("src/examples/rotate/rotate_ex.png", "rb") as f:
...     file_data = f.read()
>>> RotateCaptcha(rucaptcha_key="aa9011f31111181111168611f1151122"
...             ).captcha_handler(captcha_base64=file_data)
{
   "errorId":0,
   "status":"ready",
   "solution":{
      "rotate":180
   },
   "cost":"0.0005",
   "ip":"1.2.3.4",
   "createTime":1692863536,
   "endTime":1692863556,
   "solveCount":1,
   "taskId": 73043008354
}
>>> await RotateCaptcha(rucaptcha_key="aa9011f31111181111168611f1151122",
...             ).aio_captcha_handler(captcha_file="examples/rotate/rotate_ex.png")
{
   "errorId":0,
   "status":"ready",
   "solution":{
      "rotate":180
   },
   "cost":"0.0005",
   "ip":"1.2.3.4",
   "createTime":1692863536,
   "endTime":1692863556,
   "solveCount":1,
   "taskId": 73043008354
}
>>> await RotateCaptcha(rucaptcha_key="aa9011f31111181111168611f1151122",
...                     angle=45).aio_captcha_handler(captcha_file="examples/rotate/rotate_ex.png")
{
   "errorId":0,
   "status":"ready",
   "solution":{
      "rotate":90
   },
   "cost":"0.0005",
   "ip":"1.2.3.4",
   "createTime":1692863536,
   "endTime":1692863556,
   "solveCount":1,
   "taskId": 73043008354
}
>>> with open("src/examples/rotate/rotate_ex.png", "rb") as f:
...     file_data = f.read()
>>> await RotateCaptcha(rucaptcha_key="aa9011f31111181111168611f1151122"
...             ).aio_captcha_handler(captcha_base64=file_data)
{
   "errorId":0,
   "status":"ready",
   "solution":{
      "rotate":180
   },
   "cost":"0.0005",
   "ip":"1.2.3.4",
   "createTime":1692863536,
   "endTime":1692863556,
   "solveCount":1,
   "taskId": 73043008354
}
Returns:

Dict with full server response

captcha_handler(captcha_link: str | None = None, captcha_file: str | None = None, captcha_base64: bytes | None = None, **kwargs)

Async solving method

Parameters:
  • captcha_link (str | None) – Captcha image URL

  • captcha_file (str | None) – Captcha image file path

  • captcha_base64 (bytes | None) – Captcha image BASE64 info

  • kwargs – additional params for requests library

Returns:

Dict with full server response

Notes

Check class docstirng for more info

async aio_captcha_handler(captcha_link: str | None = None, captcha_file: str | None = None, captcha_base64: bytes | None = None, **kwargs)

Async solving method

Parameters:
  • captcha_link (str | None) – Captcha image URL

  • captcha_file (str | None) – Captcha image file path

  • captcha_base64 (bytes | None) – Captcha image BASE64 info

  • kwargs – additional params for aiohttp library

Returns:

Dict with full server response

Notes

Check class docstirng for more info