|
2 | 2 | from .serializer import RequestCreateTaskSer, RequestGetTaskResultSer |
3 | 3 | from .context_instr import AIOContextManager, SIOContextManager |
4 | 4 | from .captcha_instrument import CaptchaInstrument |
| 5 | +from .aio_captcha_instrument import AIOCaptchaInstrument |
| 6 | +from .sio_captcha_instrument import SIOCaptchaInstrument |
5 | 7 |
|
6 | 8 | __all__ = ("CaptchaParams",) |
7 | 9 |
|
@@ -33,6 +35,40 @@ def __init__( |
33 | 35 | self.request_url = request_url |
34 | 36 | self._captcha_handling_instrument = CaptchaInstrument() |
35 | 37 |
|
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