Skip to content

Commit 6b5302c

Browse files
committed
Update base.py
1 parent 9e79d43 commit 6b5302c

1 file changed

Lines changed: 39 additions & 3 deletions

File tree

src/python3_capsolver/core/base.py

Lines changed: 39 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
from .serializer import RequestCreateTaskSer, RequestGetTaskResultSer
33
from .context_instr import AIOContextManager, SIOContextManager
44
from .captcha_instrument import CaptchaInstrument
5+
from .aio_captcha_instrument import AIOCaptchaInstrument
6+
from .sio_captcha_instrument import SIOCaptchaInstrument
57

68
__all__ = ("CaptchaParams",)
79

@@ -33,6 +35,40 @@ def __init__(
3335
self.request_url = request_url
3436
self._captcha_handling_instrument = CaptchaInstrument()
3537

36-
"""
37-
Async part
38-
"""
38+
def captcha_handler(self, **additional_params) -> dict:
39+
"""
40+
Synchronous method for captcha solving
41+
42+
Args:
43+
additional_params: Some additional parameters that will be used in creating the task
44+
and will be passed to the payload under ``task`` key.
45+
Like ``proxyLogin``, ``proxyPassword`` and etc. - more info in service docs
46+
47+
Returns:
48+
Dict with full server response
49+
50+
Notes:
51+
Check class docstirng for more info
52+
"""
53+
self.task_params.update({**additional_params})
54+
self._captcha_handling_instrument = SIOCaptchaInstrument(captcha_params=self)
55+
return self._captcha_handling_instrument.processing_captcha()
56+
57+
async def aio_captcha_handler(self, **additional_params) -> dict:
58+
"""
59+
Asynchronous method for captcha solving
60+
61+
Args:
62+
additional_params: Some additional parameters that will be used in creating the task
63+
and will be passed to the payload under ``task`` key.
64+
Like ``proxyLogin``, ``proxyPassword`` and etc. - more info in service docs
65+
66+
Returns:
67+
Dict with full server response
68+
69+
Notes:
70+
Check class docstirng for more info
71+
"""
72+
self.task_params.update({**additional_params})
73+
self._captcha_handling_instrument = AIOCaptchaInstrument(captcha_params=self)
74+
return await self._captcha_handling_instrument.processing_captcha()

0 commit comments

Comments
 (0)