add new tool: to_captcha
This commit is contained in:
parent
8f86dbbdac
commit
4852345bf6
12 changed files with 716 additions and 35 deletions
|
|
@ -10,8 +10,16 @@ class BrowserRpcClient:
|
|||
self._rpc_url = rpc_url
|
||||
self._session = session
|
||||
|
||||
async def run(self, task: str, timeout_sec: float, rpc_url: str | None = None) -> dict[str, Any]:
|
||||
payload = {"task": task}
|
||||
async def run(
|
||||
self,
|
||||
task: str,
|
||||
timeout_sec: float,
|
||||
rpc_url: str | None = None,
|
||||
task_id: str | None = None,
|
||||
) -> dict[str, Any]:
|
||||
payload: dict[str, Any] = {"task": task}
|
||||
if task_id:
|
||||
payload["task_id"] = task_id
|
||||
timeout = aiohttp.ClientTimeout(total=timeout_sec)
|
||||
target_url = rpc_url or self._rpc_url
|
||||
|
||||
|
|
@ -34,6 +42,15 @@ class BrowserRpcClient:
|
|||
return data
|
||||
|
||||
|
||||
async def run_browser_task(rpc_url: str, task: str, timeout_sec: float) -> dict[str, Any]:
|
||||
async def run_browser_task(
|
||||
rpc_url: str,
|
||||
task: str,
|
||||
timeout_sec: float,
|
||||
task_id: str | None = None,
|
||||
) -> dict[str, Any]:
|
||||
async with aiohttp.ClientSession() as session:
|
||||
return await BrowserRpcClient(rpc_url, session=session).run(task=task, timeout_sec=timeout_sec)
|
||||
return await BrowserRpcClient(rpc_url, session=session).run(
|
||||
task=task,
|
||||
timeout_sec=timeout_sec,
|
||||
task_id=task_id,
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue