Skip to content

Commit

Permalink
Update image_captcha.py
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreiDrang committed Dec 7, 2023
1 parent 10780d2 commit d0e5163
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions src/python_rucaptcha/image_captcha.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import shutil
from typing import Optional
from typing import Union, Optional

from .core.base import BaseCaptcha
from .core.enums import SaveFormatsEnm, ImageCaptchaEnm
Expand All @@ -8,7 +8,7 @@
class ImageCaptcha(BaseCaptcha):
def __init__(
self,
save_format: str = SaveFormatsEnm.TEMP.value,
save_format: Union[str, SaveFormatsEnm] = SaveFormatsEnm.TEMP,
img_clearing: bool = True,
img_path: str = "PythonRuCaptchaImages",
*args,
Expand Down Expand Up @@ -199,7 +199,12 @@ 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,
)
if not self.result.errorId:
return self._processing_response(**kwargs)
Expand Down Expand Up @@ -228,7 +233,12 @@ async def aio_captcha_handler(
Check class docstirng for more info
"""
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,
)
if not self.result.errorId:
return await self._aio_processing_response()
Expand Down

0 comments on commit d0e5163

Please sign in to comment.