diff --git a/src/python_rucaptcha/rotate_captcha.py b/src/python_rucaptcha/rotate_captcha.py index aabe0505..e5ab8670 100644 --- a/src/python_rucaptcha/rotate_captcha.py +++ b/src/python_rucaptcha/rotate_captcha.py @@ -1,5 +1,6 @@ +import logging import shutil -from typing import Optional +from typing import Union, Optional from .core.base import BaseCaptcha from .core.enums import SaveFormatsEnm, RotateCaptchaEnm @@ -8,7 +9,7 @@ class RotateCaptcha(BaseCaptcha): def __init__( self, - save_format: str = SaveFormatsEnm.TEMP.value, + save_format: Union[str, SaveFormatsEnm] = SaveFormatsEnm.TEMP, img_clearing: bool = True, img_path: str = "PythonRotateCaptchaFiles", *args, @@ -141,8 +142,14 @@ def captcha_handler( Check class docstirng for more info """ self._body_file_processing( - captcha_link=captcha_link, captcha_file=captcha_file, captcha_base64=captcha_base64, **kwargs + save_format=self.save_format, + file_path=self.img_path, + captcha_link=captcha_link, + captcha_file=captcha_file, + captcha_base64=captcha_base64, + **kwargs, ) + logging.warning(f'{self.result = }') if not self.result.errorId: return self._processing_response(**kwargs) return self.result.to_dict() @@ -171,8 +178,14 @@ async def aio_captcha_handler( """ await self._aio_body_file_processing( - captcha_link=captcha_link, captcha_file=captcha_file, captcha_base64=captcha_base64, **kwargs + save_format=self.save_format, + file_path=self.img_path, + captcha_link=captcha_link, + captcha_file=captcha_file, + captcha_base64=captcha_base64, + **kwargs, ) + logging.warning(f'{self.result = }') if not self.result.errorId: return await self._aio_processing_response() return self.result.to_dict()