Skip to content

Commit d3ba6eb

Browse files
committed
Update vision_engine.py
1 parent 12378b7 commit d3ba6eb

1 file changed

Lines changed: 4 additions & 35 deletions

File tree

src/python3_capsolver/vision_engine.py

Lines changed: 4 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from typing import Any, Dict
1+
from typing import Union
22

33
from .core.base import CaptchaParams
44
from .core.enum import CaptchaTypeEnm
@@ -12,6 +12,7 @@ class VisionEngine(CaptchaParams):
1212
1313
Args:
1414
api_key: Capsolver API key
15+
captcha_type: Captcha type name, like ``VisionEngine`` 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
@@ -66,37 +67,5 @@ class VisionEngine(CaptchaParams):
6667
https://docs.capsolver.com/en/guide/recognition/VisionEngine/
6768
"""
6869

69-
def __init__(self, api_key: str, **kwargs):
70-
super().__init__(api_key=api_key, captcha_type=CaptchaTypeEnm.VisionEngine, **kwargs)
71-
72-
def captcha_handler(self, task_payload: Dict) -> Dict[str, Any]:
73-
"""
74-
Synchronous method for captcha solving
75-
76-
Args:
77-
task_payload: Captcha solving `task` payload, include `body`, `module` and other fields.
78-
79-
Returns:
80-
Dict with full server response
81-
82-
Notes:
83-
Check class docstring for more info
84-
"""
85-
task_payload.pop("type", None)
86-
return super().captcha_handler(task_payload=task_payload)
87-
88-
async def aio_captcha_handler(self, task_payload: Dict) -> Dict[str, Any]:
89-
"""
90-
Asynchronous method for captcha solving
91-
92-
Args:
93-
task_payload: Captcha solving `task` payload, include `question`, `image` 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 await super().aio_captcha_handler(task_payload=task_payload)
70+
def __init__(self, api_key: str, captcha_type: Union[CaptchaTypeEnm, str] = CaptchaTypeEnm.VisionEngine, **kwargs):
71+
super().__init__(api_key=api_key, captcha_type=captcha_type, **kwargs)

0 commit comments

Comments
 (0)