Skip to content

Commit

Permalink
Update rotate_captcha.py
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreiDrang committed Dec 7, 2023
1 parent d0e5163 commit bb6a97c
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions src/python_rucaptcha/rotate_captcha.py
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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,
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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()
Expand Down

0 comments on commit bb6a97c

Please sign in to comment.