Skip to content

Commit e76c174

Browse files
Release 2.0.10
1 parent 4f8c112 commit e76c174

18 files changed

+113
-26
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name = "browser-use-sdk"
33

44
[tool.poetry]
55
name = "browser-use-sdk"
6-
version = "2.0.9"
6+
version = "2.0.10"
77
description = "The official Python library for the Browser Use API"
88
readme = "README.md"
99
authors = []

reference.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -955,6 +955,7 @@ client = BrowserUse(
955955
)
956956
client.sessions.update_session(
957957
session_id="session_id",
958+
action="stop",
958959
)
959960

960961
```
@@ -979,6 +980,14 @@ client.sessions.update_session(
979980
<dl>
980981
<dd>
981982

983+
**action:** `SessionUpdateAction` — The action to perform on the session
984+
985+
</dd>
986+
</dl>
987+
988+
<dl>
989+
<dd>
990+
982991
**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration.
983992

984993
</dd>
@@ -2155,6 +2164,7 @@ client = BrowserUse(
21552164
)
21562165
client.browsers.update_browser_session(
21572166
session_id="session_id",
2167+
action="stop",
21582168
)
21592169

21602170
```
@@ -2179,6 +2189,14 @@ client.browsers.update_browser_session(
21792189
<dl>
21802190
<dd>
21812191

2192+
**action:** `BrowserSessionUpdateAction` — The action to perform on the session
2193+
2194+
</dd>
2195+
</dl>
2196+
2197+
<dl>
2198+
<dd>
2199+
21822200
**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration.
21832201

21842202
</dd>

src/browser_use_sdk/browsers/client.py

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
from ..types.browser_session_item_view import BrowserSessionItemView
88
from ..types.browser_session_list_response import BrowserSessionListResponse
99
from ..types.browser_session_status import BrowserSessionStatus
10+
from ..types.browser_session_update_action import BrowserSessionUpdateAction
1011
from ..types.browser_session_view import BrowserSessionView
1112
from ..types.proxy_country_code import ProxyCountryCode
1213
from .raw_client import AsyncRawBrowsersClient, RawBrowsersClient
@@ -177,7 +178,11 @@ def get_browser_session(
177178
return _response.data
178179

179180
def update_browser_session(
180-
self, session_id: str, *, request_options: typing.Optional[RequestOptions] = None
181+
self,
182+
session_id: str,
183+
*,
184+
action: BrowserSessionUpdateAction,
185+
request_options: typing.Optional[RequestOptions] = None,
181186
) -> BrowserSessionView:
182187
"""
183188
Stop a browser session.
@@ -190,6 +195,9 @@ def update_browser_session(
190195
----------
191196
session_id : str
192197
198+
action : BrowserSessionUpdateAction
199+
The action to perform on the session
200+
193201
request_options : typing.Optional[RequestOptions]
194202
Request-specific configuration.
195203
@@ -207,9 +215,10 @@ def update_browser_session(
207215
)
208216
client.browsers.update_browser_session(
209217
session_id="session_id",
218+
action="stop",
210219
)
211220
"""
212-
_response = self._raw_client.update_browser_session(session_id, request_options=request_options)
221+
_response = self._raw_client.update_browser_session(session_id, action=action, request_options=request_options)
213222
return _response.data
214223

215224

@@ -399,7 +408,11 @@ async def main() -> None:
399408
return _response.data
400409

401410
async def update_browser_session(
402-
self, session_id: str, *, request_options: typing.Optional[RequestOptions] = None
411+
self,
412+
session_id: str,
413+
*,
414+
action: BrowserSessionUpdateAction,
415+
request_options: typing.Optional[RequestOptions] = None,
403416
) -> BrowserSessionView:
404417
"""
405418
Stop a browser session.
@@ -412,6 +425,9 @@ async def update_browser_session(
412425
----------
413426
session_id : str
414427
428+
action : BrowserSessionUpdateAction
429+
The action to perform on the session
430+
415431
request_options : typing.Optional[RequestOptions]
416432
Request-specific configuration.
417433
@@ -434,10 +450,13 @@ async def update_browser_session(
434450
async def main() -> None:
435451
await client.browsers.update_browser_session(
436452
session_id="session_id",
453+
action="stop",
437454
)
438455
439456
440457
asyncio.run(main())
441458
"""
442-
_response = await self._raw_client.update_browser_session(session_id, request_options=request_options)
459+
_response = await self._raw_client.update_browser_session(
460+
session_id, action=action, request_options=request_options
461+
)
443462
return _response.data

src/browser_use_sdk/browsers/raw_client.py

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
from ..types.browser_session_item_view import BrowserSessionItemView
1717
from ..types.browser_session_list_response import BrowserSessionListResponse
1818
from ..types.browser_session_status import BrowserSessionStatus
19+
from ..types.browser_session_update_action import BrowserSessionUpdateAction
1920
from ..types.browser_session_view import BrowserSessionView
2021
from ..types.proxy_country_code import ProxyCountryCode
2122
from ..types.session_timeout_limit_exceeded_error import SessionTimeoutLimitExceededError
@@ -282,7 +283,11 @@ def get_browser_session(
282283
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
283284

284285
def update_browser_session(
285-
self, session_id: str, *, request_options: typing.Optional[RequestOptions] = None
286+
self,
287+
session_id: str,
288+
*,
289+
action: BrowserSessionUpdateAction,
290+
request_options: typing.Optional[RequestOptions] = None,
286291
) -> HttpResponse[BrowserSessionView]:
287292
"""
288293
Stop a browser session.
@@ -295,6 +300,9 @@ def update_browser_session(
295300
----------
296301
session_id : str
297302
303+
action : BrowserSessionUpdateAction
304+
The action to perform on the session
305+
298306
request_options : typing.Optional[RequestOptions]
299307
Request-specific configuration.
300308
@@ -307,7 +315,7 @@ def update_browser_session(
307315
f"browsers/{jsonable_encoder(session_id)}",
308316
method="PATCH",
309317
json={
310-
"action": "stop",
318+
"action": action,
311319
},
312320
headers={
313321
"content-type": "application/json",
@@ -610,7 +618,11 @@ async def get_browser_session(
610618
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
611619

612620
async def update_browser_session(
613-
self, session_id: str, *, request_options: typing.Optional[RequestOptions] = None
621+
self,
622+
session_id: str,
623+
*,
624+
action: BrowserSessionUpdateAction,
625+
request_options: typing.Optional[RequestOptions] = None,
614626
) -> AsyncHttpResponse[BrowserSessionView]:
615627
"""
616628
Stop a browser session.
@@ -623,6 +635,9 @@ async def update_browser_session(
623635
----------
624636
session_id : str
625637
638+
action : BrowserSessionUpdateAction
639+
The action to perform on the session
640+
626641
request_options : typing.Optional[RequestOptions]
627642
Request-specific configuration.
628643
@@ -635,7 +650,7 @@ async def update_browser_session(
635650
f"browsers/{jsonable_encoder(session_id)}",
636651
method="PATCH",
637652
json={
638-
"action": "stop",
653+
"action": action,
639654
},
640655
headers={
641656
"content-type": "application/json",

src/browser_use_sdk/core/client_wrapper.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ def __init__(
2222

2323
def get_headers(self) -> typing.Dict[str, str]:
2424
headers: typing.Dict[str, str] = {
25-
"User-Agent": "browser-use-sdk/2.0.9",
25+
"User-Agent": "browser-use-sdk/2.0.10",
2626
"X-Fern-Language": "Python",
2727
"X-Fern-SDK-Name": "browser-use-sdk",
28-
"X-Fern-SDK-Version": "2.0.9",
28+
"X-Fern-SDK-Version": "2.0.10",
2929
**(self.get_custom_headers() or {}),
3030
}
3131
headers["X-Browser-Use-API-Key"] = self.api_key

src/browser_use_sdk/sessions/client.py

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
from ..types.session_item_view import SessionItemView
99
from ..types.session_list_response import SessionListResponse
1010
from ..types.session_status import SessionStatus
11+
from ..types.session_update_action import SessionUpdateAction
1112
from ..types.session_view import SessionView
1213
from ..types.share_view import ShareView
1314
from .raw_client import AsyncRawSessionsClient, RawSessionsClient
@@ -189,7 +190,7 @@ def delete_session(self, session_id: str, *, request_options: typing.Optional[Re
189190
return _response.data
190191

191192
def update_session(
192-
self, session_id: str, *, request_options: typing.Optional[RequestOptions] = None
193+
self, session_id: str, *, action: SessionUpdateAction, request_options: typing.Optional[RequestOptions] = None
193194
) -> SessionView:
194195
"""
195196
Stop a session and all its running tasks.
@@ -198,6 +199,9 @@ def update_session(
198199
----------
199200
session_id : str
200201
202+
action : SessionUpdateAction
203+
The action to perform on the session
204+
201205
request_options : typing.Optional[RequestOptions]
202206
Request-specific configuration.
203207
@@ -215,9 +219,10 @@ def update_session(
215219
)
216220
client.sessions.update_session(
217221
session_id="session_id",
222+
action="stop",
218223
)
219224
"""
220-
_response = self._raw_client.update_session(session_id, request_options=request_options)
225+
_response = self._raw_client.update_session(session_id, action=action, request_options=request_options)
221226
return _response.data
222227

223228
def get_session_public_share(
@@ -523,7 +528,7 @@ async def main() -> None:
523528
return _response.data
524529

525530
async def update_session(
526-
self, session_id: str, *, request_options: typing.Optional[RequestOptions] = None
531+
self, session_id: str, *, action: SessionUpdateAction, request_options: typing.Optional[RequestOptions] = None
527532
) -> SessionView:
528533
"""
529534
Stop a session and all its running tasks.
@@ -532,6 +537,9 @@ async def update_session(
532537
----------
533538
session_id : str
534539
540+
action : SessionUpdateAction
541+
The action to perform on the session
542+
535543
request_options : typing.Optional[RequestOptions]
536544
Request-specific configuration.
537545
@@ -554,12 +562,13 @@ async def update_session(
554562
async def main() -> None:
555563
await client.sessions.update_session(
556564
session_id="session_id",
565+
action="stop",
557566
)
558567
559568
560569
asyncio.run(main())
561570
"""
562-
_response = await self._raw_client.update_session(session_id, request_options=request_options)
571+
_response = await self._raw_client.update_session(session_id, action=action, request_options=request_options)
563572
return _response.data
564573

565574
async def get_session_public_share(

src/browser_use_sdk/sessions/raw_client.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
from ..types.session_item_view import SessionItemView
1717
from ..types.session_list_response import SessionListResponse
1818
from ..types.session_status import SessionStatus
19+
from ..types.session_update_action import SessionUpdateAction
1920
from ..types.session_view import SessionView
2021
from ..types.share_view import ShareView
2122
from ..types.too_many_concurrent_active_sessions_error import TooManyConcurrentActiveSessionsError
@@ -306,7 +307,7 @@ def delete_session(
306307
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
307308

308309
def update_session(
309-
self, session_id: str, *, request_options: typing.Optional[RequestOptions] = None
310+
self, session_id: str, *, action: SessionUpdateAction, request_options: typing.Optional[RequestOptions] = None
310311
) -> HttpResponse[SessionView]:
311312
"""
312313
Stop a session and all its running tasks.
@@ -315,6 +316,9 @@ def update_session(
315316
----------
316317
session_id : str
317318
319+
action : SessionUpdateAction
320+
The action to perform on the session
321+
318322
request_options : typing.Optional[RequestOptions]
319323
Request-specific configuration.
320324
@@ -327,7 +331,7 @@ def update_session(
327331
f"sessions/{jsonable_encoder(session_id)}",
328332
method="PATCH",
329333
json={
330-
"action": "stop",
334+
"action": action,
331335
},
332336
headers={
333337
"content-type": "application/json",
@@ -827,7 +831,7 @@ async def delete_session(
827831
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
828832

829833
async def update_session(
830-
self, session_id: str, *, request_options: typing.Optional[RequestOptions] = None
834+
self, session_id: str, *, action: SessionUpdateAction, request_options: typing.Optional[RequestOptions] = None
831835
) -> AsyncHttpResponse[SessionView]:
832836
"""
833837
Stop a session and all its running tasks.
@@ -836,6 +840,9 @@ async def update_session(
836840
----------
837841
session_id : str
838842
843+
action : SessionUpdateAction
844+
The action to perform on the session
845+
839846
request_options : typing.Optional[RequestOptions]
840847
Request-specific configuration.
841848
@@ -848,7 +855,7 @@ async def update_session(
848855
f"sessions/{jsonable_encoder(session_id)}",
849856
method="PATCH",
850857
json={
851-
"action": "stop",
858+
"action": action,
852859
},
853860
headers={
854861
"content-type": "application/json",

src/browser_use_sdk/tasks/types/create_task_request_vision.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,6 @@
22

33
import typing
44

5-
CreateTaskRequestVision = typing.Union[bool, typing.Literal["auto"]]
5+
from .create_task_request_vision_one import CreateTaskRequestVisionOne
6+
7+
CreateTaskRequestVision = typing.Union[bool, CreateTaskRequestVisionOne]
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# This file was auto-generated by Fern from our API Definition.
2+
3+
import typing
4+
5+
CreateTaskRequestVisionOne = typing.Union[typing.Literal["auto"], typing.Any]

src/browser_use_sdk/types/app_api_v_2_skills_views_insufficient_credits_error.py renamed to src/browser_use_sdk/types/app_api_v2skills_views_insufficient_credits_error.py

File renamed without changes.

0 commit comments

Comments
 (0)