Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion packages/notte-sdk/src/notte_sdk/endpoints/page.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
if TYPE_CHECKING:
from notte_sdk.client import NotteClient

CAPTCHA_SOLVE_REQUEST_TIMEOUT_SECONDS = 150


@final
class PageClient(BaseClient):
Expand Down Expand Up @@ -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:
Expand Down
14 changes: 14 additions & 0 deletions tests/sdk/test_page_execute_timeout.py
Original file line number Diff line number Diff line change
@@ -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
Loading