Skip to content

Commit 2133e64

Browse files
committed
fixed outdated client
1 parent d7aa39b commit 2133e64

File tree

3 files changed

+41
-21
lines changed

3 files changed

+41
-21
lines changed

src/browser_use_sdk/client.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,15 @@
33
import typing
44

55
import httpx
6-
from .accounts.client import AccountsClient, AsyncAccountsClient
6+
# from .accounts.client import AccountsClient, AsyncAccountsClient # Module not yet available
7+
from .billing.client import AsyncBillingClient, BillingClient
8+
from .browsers.client import AsyncBrowsersClient, BrowsersClient
79
from .core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
810
from .environment import BrowserUseEnvironment
911
from .files.client import AsyncFilesClient, FilesClient
1012
from .profiles.client import AsyncProfilesClient, ProfilesClient
1113
from .sessions.client import AsyncSessionsClient, SessionsClient
14+
from .workflows.client import AsyncWorkflowsClient, WorkflowsClient
1215
from .wrapper.tasks.client import AsyncBrowserUseTasksClient, BrowserUseTasksClient
1316

1417

@@ -77,11 +80,14 @@ def __init__(
7780
else httpx.Client(timeout=_defaulted_timeout),
7881
timeout=_defaulted_timeout,
7982
)
80-
self.accounts = AccountsClient(client_wrapper=self._client_wrapper)
83+
# self.accounts = AccountsClient(client_wrapper=self._client_wrapper) # Module not yet available
84+
self.billing = BillingClient(client_wrapper=self._client_wrapper)
85+
self.browsers = BrowsersClient(client_wrapper=self._client_wrapper)
8186
self.tasks = BrowserUseTasksClient(client_wrapper=self._client_wrapper)
8287
self.sessions = SessionsClient(client_wrapper=self._client_wrapper)
8388
self.files = FilesClient(client_wrapper=self._client_wrapper)
8489
self.profiles = ProfilesClient(client_wrapper=self._client_wrapper)
90+
self.workflows = WorkflowsClient(client_wrapper=self._client_wrapper)
8591

8692

8793
class AsyncBrowserUse:
@@ -149,11 +155,14 @@ def __init__(
149155
else httpx.AsyncClient(timeout=_defaulted_timeout),
150156
timeout=_defaulted_timeout,
151157
)
152-
self.accounts = AsyncAccountsClient(client_wrapper=self._client_wrapper)
158+
# self.accounts = AsyncAccountsClient(client_wrapper=self._client_wrapper) # Module not yet available
159+
self.billing = AsyncBillingClient(client_wrapper=self._client_wrapper)
160+
self.browsers = AsyncBrowsersClient(client_wrapper=self._client_wrapper)
153161
self.tasks = AsyncBrowserUseTasksClient(client_wrapper=self._client_wrapper)
154162
self.sessions = AsyncSessionsClient(client_wrapper=self._client_wrapper)
155163
self.files = AsyncFilesClient(client_wrapper=self._client_wrapper)
156164
self.profiles = AsyncProfilesClient(client_wrapper=self._client_wrapper)
165+
self.workflows = AsyncWorkflowsClient(client_wrapper=self._client_wrapper)
157166

158167

159168
def _get_base_url(*, base_url: typing.Optional[str] = None, environment: BrowserUseEnvironment) -> str:

src/browser_use_sdk/wrapper/parse.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,8 @@ def _stream(
8686
class WrappedTaskCreatedResponse(TaskCreatedResponse):
8787
"""TaskCreatedResponse with utility methods for easier interfacing with Browser Use Cloud."""
8888

89-
def __init__(self, id: str, client: TasksClient):
90-
super().__init__(id=id)
89+
def __init__(self, id: str, session_id: str, client: TasksClient):
90+
super().__init__(id=id, session_id=session_id)
9191
self._client = client
9292

9393
def complete(self, interval: float = 1, request_options: typing.Optional[RequestOptions] = None) -> TaskView:
@@ -115,8 +115,8 @@ def watch(self, interval: float = 1, request_options: typing.Optional[RequestOpt
115115
class WrappedStructuredTaskCreatedResponse(TaskCreatedResponse, Generic[T]):
116116
"""TaskCreatedResponse with structured output."""
117117

118-
def __init__(self, id: str, schema: Type[T], client: TasksClient):
119-
super().__init__(id=id)
118+
def __init__(self, id: str, session_id: str, schema: Type[T], client: TasksClient):
119+
super().__init__(id=id, session_id=session_id)
120120

121121
self._client = client
122122
self._schema = schema
@@ -180,8 +180,8 @@ async def _async_stream(
180180
class AsyncWrappedTaskCreatedResponse(TaskCreatedResponse):
181181
"""TaskCreatedResponse with utility methods for easier interfacing with Browser Use Cloud."""
182182

183-
def __init__(self, id: str, client: AsyncTasksClient):
184-
super().__init__(id=id)
183+
def __init__(self, id: str, session_id: str, client: AsyncTasksClient):
184+
super().__init__(id=id, session_id=session_id)
185185
self._client = client
186186

187187
async def complete(self, interval: float = 1, request_options: typing.Optional[RequestOptions] = None) -> TaskView:
@@ -211,8 +211,8 @@ def watch(
211211
class AsyncWrappedStructuredTaskCreatedResponse(TaskCreatedResponse, Generic[T]):
212212
"""TaskCreatedResponse with structured output."""
213213

214-
def __init__(self, id: str, schema: Type[T], client: AsyncTasksClient):
215-
super().__init__(id=id)
214+
def __init__(self, id: str, session_id: str, schema: Type[T], client: AsyncTasksClient):
215+
super().__init__(id=id, session_id=session_id)
216216

217217
self._client = client
218218
self._schema = schema

src/browser_use_sdk/wrapper/tasks/client.py

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
from browser_use_sdk.core.request_options import RequestOptions
55
from browser_use_sdk.tasks.client import OMIT, AsyncClientWrapper, AsyncTasksClient, SyncClientWrapper, TasksClient
6+
from browser_use_sdk.tasks.types.create_task_request_vision import CreateTaskRequestVision
67
from browser_use_sdk.types.supported_ll_ms import SupportedLlMs
78
from browser_use_sdk.types.task_view import TaskView
89
from browser_use_sdk.wrapper.parse import (
@@ -35,10 +36,11 @@ def create_task(
3536
metadata: typing.Optional[typing.Dict[str, typing.Optional[str]]] = OMIT,
3637
secrets: typing.Optional[typing.Dict[str, typing.Optional[str]]] = OMIT,
3738
allowed_domains: typing.Optional[typing.Sequence[str]] = OMIT,
39+
op_vault_id: typing.Optional[str] = OMIT,
3840
highlight_elements: typing.Optional[bool] = OMIT,
3941
flash_mode: typing.Optional[bool] = OMIT,
4042
thinking: typing.Optional[bool] = OMIT,
41-
vision: typing.Optional[bool] = OMIT,
43+
vision: typing.Optional[CreateTaskRequestVision] = OMIT,
4244
system_prompt_extension: typing.Optional[str] = OMIT,
4345
request_options: typing.Optional[RequestOptions] = None,
4446
) -> WrappedStructuredTaskCreatedResponse[T]: ...
@@ -56,10 +58,11 @@ def create_task(
5658
metadata: typing.Optional[typing.Dict[str, typing.Optional[str]]] = OMIT,
5759
secrets: typing.Optional[typing.Dict[str, typing.Optional[str]]] = OMIT,
5860
allowed_domains: typing.Optional[typing.Sequence[str]] = OMIT,
61+
op_vault_id: typing.Optional[str] = OMIT,
5962
highlight_elements: typing.Optional[bool] = OMIT,
6063
flash_mode: typing.Optional[bool] = OMIT,
6164
thinking: typing.Optional[bool] = OMIT,
62-
vision: typing.Optional[bool] = OMIT,
65+
vision: typing.Optional[CreateTaskRequestVision] = OMIT,
6366
system_prompt_extension: typing.Optional[str] = OMIT,
6467
request_options: typing.Optional[RequestOptions] = None,
6568
) -> WrappedTaskCreatedResponse: ...
@@ -77,10 +80,11 @@ def create_task(
7780
metadata: typing.Optional[typing.Dict[str, typing.Optional[str]]] = OMIT,
7881
secrets: typing.Optional[typing.Dict[str, typing.Optional[str]]] = OMIT,
7982
allowed_domains: typing.Optional[typing.Sequence[str]] = OMIT,
83+
op_vault_id: typing.Optional[str] = OMIT,
8084
highlight_elements: typing.Optional[bool] = OMIT,
8185
flash_mode: typing.Optional[bool] = OMIT,
8286
thinking: typing.Optional[bool] = OMIT,
83-
vision: typing.Optional[bool] = OMIT,
87+
vision: typing.Optional[CreateTaskRequestVision] = OMIT,
8488
system_prompt_extension: typing.Optional[str] = OMIT,
8589
request_options: typing.Optional[RequestOptions] = None,
8690
) -> typing.Union[WrappedStructuredTaskCreatedResponse[T], WrappedTaskCreatedResponse]:
@@ -97,6 +101,7 @@ def create_task(
97101
metadata=metadata,
98102
secrets=secrets,
99103
allowed_domains=allowed_domains,
104+
op_vault_id=op_vault_id,
100105
highlight_elements=highlight_elements,
101106
flash_mode=flash_mode,
102107
thinking=thinking,
@@ -105,7 +110,7 @@ def create_task(
105110
request_options=request_options,
106111
)
107112

108-
return WrappedStructuredTaskCreatedResponse[T](id=res.id, schema=schema, client=self)
113+
return WrappedStructuredTaskCreatedResponse[T](id=res.id, session_id=res.session_id, schema=schema, client=self)
109114

110115
else:
111116
res = super().create_task(
@@ -118,6 +123,7 @@ def create_task(
118123
metadata=metadata,
119124
secrets=secrets,
120125
allowed_domains=allowed_domains,
126+
op_vault_id=op_vault_id,
121127
highlight_elements=highlight_elements,
122128
flash_mode=flash_mode,
123129
thinking=thinking,
@@ -126,7 +132,7 @@ def create_task(
126132
request_options=request_options,
127133
)
128134

129-
return WrappedTaskCreatedResponse(id=res.id, client=self)
135+
return WrappedTaskCreatedResponse(id=res.id, session_id=res.session_id, client=self)
130136

131137
@typing.overload
132138
def get_task(
@@ -170,10 +176,11 @@ async def create_task(
170176
metadata: typing.Optional[typing.Dict[str, typing.Optional[str]]] = OMIT,
171177
secrets: typing.Optional[typing.Dict[str, typing.Optional[str]]] = OMIT,
172178
allowed_domains: typing.Optional[typing.Sequence[str]] = OMIT,
179+
op_vault_id: typing.Optional[str] = OMIT,
173180
highlight_elements: typing.Optional[bool] = OMIT,
174181
flash_mode: typing.Optional[bool] = OMIT,
175182
thinking: typing.Optional[bool] = OMIT,
176-
vision: typing.Optional[bool] = OMIT,
183+
vision: typing.Optional[CreateTaskRequestVision] = OMIT,
177184
system_prompt_extension: typing.Optional[str] = OMIT,
178185
request_options: typing.Optional[RequestOptions] = None,
179186
) -> AsyncWrappedStructuredTaskCreatedResponse[T]: ...
@@ -191,10 +198,11 @@ async def create_task(
191198
metadata: typing.Optional[typing.Dict[str, typing.Optional[str]]] = OMIT,
192199
secrets: typing.Optional[typing.Dict[str, typing.Optional[str]]] = OMIT,
193200
allowed_domains: typing.Optional[typing.Sequence[str]] = OMIT,
201+
op_vault_id: typing.Optional[str] = OMIT,
194202
highlight_elements: typing.Optional[bool] = OMIT,
195203
flash_mode: typing.Optional[bool] = OMIT,
196204
thinking: typing.Optional[bool] = OMIT,
197-
vision: typing.Optional[bool] = OMIT,
205+
vision: typing.Optional[CreateTaskRequestVision] = OMIT,
198206
system_prompt_extension: typing.Optional[str] = OMIT,
199207
request_options: typing.Optional[RequestOptions] = None,
200208
) -> AsyncWrappedTaskCreatedResponse: ...
@@ -212,10 +220,11 @@ async def create_task(
212220
metadata: typing.Optional[typing.Dict[str, typing.Optional[str]]] = OMIT,
213221
secrets: typing.Optional[typing.Dict[str, typing.Optional[str]]] = OMIT,
214222
allowed_domains: typing.Optional[typing.Sequence[str]] = OMIT,
223+
op_vault_id: typing.Optional[str] = OMIT,
215224
highlight_elements: typing.Optional[bool] = OMIT,
216225
flash_mode: typing.Optional[bool] = OMIT,
217226
thinking: typing.Optional[bool] = OMIT,
218-
vision: typing.Optional[bool] = OMIT,
227+
vision: typing.Optional[CreateTaskRequestVision] = OMIT,
219228
system_prompt_extension: typing.Optional[str] = OMIT,
220229
request_options: typing.Optional[RequestOptions] = None,
221230
) -> typing.Union[AsyncWrappedStructuredTaskCreatedResponse[T], AsyncWrappedTaskCreatedResponse]:
@@ -232,14 +241,15 @@ async def create_task(
232241
metadata=metadata,
233242
secrets=secrets,
234243
allowed_domains=allowed_domains,
244+
op_vault_id=op_vault_id,
235245
highlight_elements=highlight_elements,
236246
flash_mode=flash_mode,
237247
thinking=thinking,
238248
vision=vision,
239249
system_prompt_extension=system_prompt_extension,
240250
request_options=request_options,
241251
)
242-
return AsyncWrappedStructuredTaskCreatedResponse[T](id=res.id, schema=schema, client=self)
252+
return AsyncWrappedStructuredTaskCreatedResponse[T](id=res.id, session_id=res.session_id, schema=schema, client=self)
243253

244254
else:
245255
res = await super().create_task(
@@ -252,14 +262,15 @@ async def create_task(
252262
metadata=metadata,
253263
secrets=secrets,
254264
allowed_domains=allowed_domains,
265+
op_vault_id=op_vault_id,
255266
highlight_elements=highlight_elements,
256267
flash_mode=flash_mode,
257268
thinking=thinking,
258269
vision=vision,
259270
system_prompt_extension=system_prompt_extension,
260271
request_options=request_options,
261272
)
262-
return AsyncWrappedTaskCreatedResponse(id=res.id, client=self)
273+
return AsyncWrappedTaskCreatedResponse(id=res.id, session_id=res.session_id, client=self)
263274

264275
@typing.overload
265276
async def get_task(

0 commit comments

Comments
 (0)