diff --git a/packages/notte-sdk/src/notte_sdk/endpoints/page.py b/packages/notte-sdk/src/notte_sdk/endpoints/page.py index 6d192ae56..6af5d4af2 100644 --- a/packages/notte-sdk/src/notte_sdk/endpoints/page.py +++ b/packages/notte-sdk/src/notte_sdk/endpoints/page.py @@ -26,6 +26,8 @@ if TYPE_CHECKING: from notte_sdk.client import NotteClient +CAPTCHA_SOLVE_REQUEST_TIMEOUT_SECONDS = 150 + @final class PageClient(BaseClient): @@ -290,7 +292,7 @@ def execute(self, session_id: str, action: ActionUnion) -> ExecutionResultRespon """ endpoint = PageClient._page_execute_endpoint(session_id=session_id) is_captcha = isinstance(action, CaptchaSolveAction) - request_timeout = 100 if is_captcha else self.DEFAULT_REQUEST_TIMEOUT_SECONDS + request_timeout = CAPTCHA_SOLVE_REQUEST_TIMEOUT_SECONDS if is_captcha else self.DEFAULT_REQUEST_TIMEOUT_SECONDS for _ in range(3): try: diff --git a/tests/sdk/test_page_execute_timeout.py b/tests/sdk/test_page_execute_timeout.py new file mode 100644 index 000000000..1bd2feb20 --- /dev/null +++ b/tests/sdk/test_page_execute_timeout.py @@ -0,0 +1,14 @@ +from unittest.mock import MagicMock + +from notte_core.actions import CaptchaSolveAction +from notte_sdk.endpoints.page import CAPTCHA_SOLVE_REQUEST_TIMEOUT_SECONDS, PageClient + + +def test_captcha_solve_uses_150_second_request_timeout() -> None: + client = PageClient.__new__(PageClient) + client.request = MagicMock(return_value=MagicMock()) + + client.execute("session-id", CaptchaSolveAction(captcha_type="recaptcha")) + + assert CAPTCHA_SOLVE_REQUEST_TIMEOUT_SECONDS == 150 + assert client.request.call_args.kwargs["timeout"] == CAPTCHA_SOLVE_REQUEST_TIMEOUT_SECONDS