1- from typing import Any , Dict
1+ from typing import Union
22
33from .core .base import CaptchaParams
44from .core .enum import CaptchaTypeEnm
@@ -12,6 +12,7 @@ class ImageToText(CaptchaParams):
1212
1313 Args:
1414 api_key: Capsolver API key
15+ captcha_type: Captcha type name, like ``ImageToTextTask`` and etc.
1516 kwargs: additional params for client, like captcha waiting time
1617 available keys:
1718 - sleep_time: int - captcha solution waintig time in sec
@@ -81,38 +82,8 @@ class ImageToText(CaptchaParams):
8182 https://docs.capsolver.com/guide/recognition/ImageToTextTask.html
8283 """
8384
84- def __init__ (self , api_key : str , ** kwargs ):
85+ def __init__ (
86+ self , api_key : str , captcha_type : Union [CaptchaTypeEnm , str ] = CaptchaTypeEnm .ImageToTextTask , ** kwargs
87+ ):
8588
86- super ().__init__ (api_key = api_key , captcha_type = CaptchaTypeEnm .ImageToTextTask , ** kwargs )
87-
88- def captcha_handler (self , task_payload : Dict ) -> Dict [str , Any ]:
89- """
90- Synchronous method for captcha solving
91-
92- Args:
93- task_payload: Captcha solving `task` payload, include `body`, `module` and other fields.
94-
95- Returns:
96- Dict with full server response
97-
98- Notes:
99- Check class docstring for more info
100- """
101- task_payload .pop ("type" , None )
102- return super ().captcha_handler (task_payload = task_payload )
103-
104- async def aio_captcha_handler (self , task_payload : Dict ) -> Dict [str , Any ]:
105- """
106- Asynchronous method for captcha solving
107-
108- Args:
109- task_payload: Captcha solving `task` payload, include `body`, `module` and other fields.
110-
111- Returns:
112- Dict with full server response
113-
114- Notes:
115- Check class docstring for more info
116- """
117- task_payload .pop ("type" , None )
118- return await super ().aio_captcha_handler (task_payload = task_payload )
89+ super ().__init__ (api_key = api_key , captcha_type = captcha_type , ** kwargs )
0 commit comments