Skip to content

Commit c9e4db0

Browse files
Release 2.0.12
1 parent 7257f37 commit c9e4db0

12 files changed

+321
-34
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.11"
6+
version = "2.0.12"
77
description = "The official Python library for the Browser Use API"
88
readme = "README.md"
99
authors = []

reference.md

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2729,6 +2729,76 @@ client.skills.cancel_generation(
27292729
</dl>
27302730

27312731

2732+
</dd>
2733+
</dl>
2734+
</details>
2735+
2736+
<details><summary><code>client.skills.<a href="src/browser_use_sdk/skills/client.py">rollback_skill</a>(...)</code></summary>
2737+
<dl>
2738+
<dd>
2739+
2740+
#### 📝 Description
2741+
2742+
<dl>
2743+
<dd>
2744+
2745+
<dl>
2746+
<dd>
2747+
2748+
Rollback to the previous version (cannot be undone).
2749+
</dd>
2750+
</dl>
2751+
</dd>
2752+
</dl>
2753+
2754+
#### 🔌 Usage
2755+
2756+
<dl>
2757+
<dd>
2758+
2759+
<dl>
2760+
<dd>
2761+
2762+
```python
2763+
from browser_use_sdk import BrowserUse
2764+
2765+
client = BrowserUse(
2766+
api_key="YOUR_API_KEY",
2767+
)
2768+
client.skills.rollback_skill(
2769+
skill_id="skill_id",
2770+
)
2771+
2772+
```
2773+
</dd>
2774+
</dl>
2775+
</dd>
2776+
</dl>
2777+
2778+
#### ⚙️ Parameters
2779+
2780+
<dl>
2781+
<dd>
2782+
2783+
<dl>
2784+
<dd>
2785+
2786+
**skill_id:** `str`
2787+
2788+
</dd>
2789+
</dl>
2790+
2791+
<dl>
2792+
<dd>
2793+
2794+
**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration.
2795+
2796+
</dd>
2797+
</dl>
2798+
</dd>
2799+
</dl>
2800+
2801+
27322802
</dd>
27332803
</dl>
27342804
</details>

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.11",
25+
"User-Agent": "browser-use-sdk/2.0.12",
2626
"X-Fern-Language": "Python",
2727
"X-Fern-SDK-Name": "browser-use-sdk",
28-
"X-Fern-SDK-Version": "2.0.11",
28+
"X-Fern-SDK-Version": "2.0.12",
2929
**(self.get_custom_headers() or {}),
3030
}
3131
headers["X-Browser-Use-API-Key"] = self.api_key

src/browser_use_sdk/skills/client.py

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,38 @@ def cancel_generation(
291291
_response = self._raw_client.cancel_generation(skill_id, request_options=request_options)
292292
return _response.data
293293

294+
def rollback_skill(
295+
self, skill_id: str, *, request_options: typing.Optional[RequestOptions] = None
296+
) -> SkillResponse:
297+
"""
298+
Rollback to the previous version (cannot be undone).
299+
300+
Parameters
301+
----------
302+
skill_id : str
303+
304+
request_options : typing.Optional[RequestOptions]
305+
Request-specific configuration.
306+
307+
Returns
308+
-------
309+
SkillResponse
310+
Successful Response
311+
312+
Examples
313+
--------
314+
from browser_use_sdk import BrowserUse
315+
316+
client = BrowserUse(
317+
api_key="YOUR_API_KEY",
318+
)
319+
client.skills.rollback_skill(
320+
skill_id="skill_id",
321+
)
322+
"""
323+
_response = self._raw_client.rollback_skill(skill_id, request_options=request_options)
324+
return _response.data
325+
294326
def execute_skill(
295327
self,
296328
skill_id: str,
@@ -706,6 +738,46 @@ async def main() -> None:
706738
_response = await self._raw_client.cancel_generation(skill_id, request_options=request_options)
707739
return _response.data
708740

741+
async def rollback_skill(
742+
self, skill_id: str, *, request_options: typing.Optional[RequestOptions] = None
743+
) -> SkillResponse:
744+
"""
745+
Rollback to the previous version (cannot be undone).
746+
747+
Parameters
748+
----------
749+
skill_id : str
750+
751+
request_options : typing.Optional[RequestOptions]
752+
Request-specific configuration.
753+
754+
Returns
755+
-------
756+
SkillResponse
757+
Successful Response
758+
759+
Examples
760+
--------
761+
import asyncio
762+
763+
from browser_use_sdk import AsyncBrowserUse
764+
765+
client = AsyncBrowserUse(
766+
api_key="YOUR_API_KEY",
767+
)
768+
769+
770+
async def main() -> None:
771+
await client.skills.rollback_skill(
772+
skill_id="skill_id",
773+
)
774+
775+
776+
asyncio.run(main())
777+
"""
778+
_response = await self._raw_client.rollback_skill(skill_id, request_options=request_options)
779+
return _response.data
780+
709781
async def execute_skill(
710782
self,
711783
skill_id: str,

src/browser_use_sdk/skills/raw_client.py

Lines changed: 144 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,78 @@ def cancel_generation(
425425
Successful Response
426426
"""
427427
_response = self._client_wrapper.httpx_client.request(
428-
f"skills/{jsonable_encoder(skill_id)}/cancel-generation",
428+
f"skills/{jsonable_encoder(skill_id)}/cancel",
429+
method="POST",
430+
request_options=request_options,
431+
)
432+
try:
433+
if 200 <= _response.status_code < 300:
434+
_data = typing.cast(
435+
SkillResponse,
436+
construct_type(
437+
type_=SkillResponse, # type: ignore
438+
object_=_response.json(),
439+
),
440+
)
441+
return HttpResponse(response=_response, data=_data)
442+
if _response.status_code == 400:
443+
raise BadRequestError(
444+
headers=dict(_response.headers),
445+
body=typing.cast(
446+
typing.Optional[typing.Any],
447+
construct_type(
448+
type_=typing.Optional[typing.Any], # type: ignore
449+
object_=_response.json(),
450+
),
451+
),
452+
)
453+
if _response.status_code == 404:
454+
raise NotFoundError(
455+
headers=dict(_response.headers),
456+
body=typing.cast(
457+
typing.Optional[typing.Any],
458+
construct_type(
459+
type_=typing.Optional[typing.Any], # type: ignore
460+
object_=_response.json(),
461+
),
462+
),
463+
)
464+
if _response.status_code == 422:
465+
raise UnprocessableEntityError(
466+
headers=dict(_response.headers),
467+
body=typing.cast(
468+
typing.Optional[typing.Any],
469+
construct_type(
470+
type_=typing.Optional[typing.Any], # type: ignore
471+
object_=_response.json(),
472+
),
473+
),
474+
)
475+
_response_json = _response.json()
476+
except JSONDecodeError:
477+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
478+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
479+
480+
def rollback_skill(
481+
self, skill_id: str, *, request_options: typing.Optional[RequestOptions] = None
482+
) -> HttpResponse[SkillResponse]:
483+
"""
484+
Rollback to the previous version (cannot be undone).
485+
486+
Parameters
487+
----------
488+
skill_id : str
489+
490+
request_options : typing.Optional[RequestOptions]
491+
Request-specific configuration.
492+
493+
Returns
494+
-------
495+
HttpResponse[SkillResponse]
496+
Successful Response
497+
"""
498+
_response = self._client_wrapper.httpx_client.request(
499+
f"skills/{jsonable_encoder(skill_id)}/rollback",
429500
method="POST",
430501
request_options=request_options,
431502
)
@@ -1069,7 +1140,78 @@ async def cancel_generation(
10691140
Successful Response
10701141
"""
10711142
_response = await self._client_wrapper.httpx_client.request(
1072-
f"skills/{jsonable_encoder(skill_id)}/cancel-generation",
1143+
f"skills/{jsonable_encoder(skill_id)}/cancel",
1144+
method="POST",
1145+
request_options=request_options,
1146+
)
1147+
try:
1148+
if 200 <= _response.status_code < 300:
1149+
_data = typing.cast(
1150+
SkillResponse,
1151+
construct_type(
1152+
type_=SkillResponse, # type: ignore
1153+
object_=_response.json(),
1154+
),
1155+
)
1156+
return AsyncHttpResponse(response=_response, data=_data)
1157+
if _response.status_code == 400:
1158+
raise BadRequestError(
1159+
headers=dict(_response.headers),
1160+
body=typing.cast(
1161+
typing.Optional[typing.Any],
1162+
construct_type(
1163+
type_=typing.Optional[typing.Any], # type: ignore
1164+
object_=_response.json(),
1165+
),
1166+
),
1167+
)
1168+
if _response.status_code == 404:
1169+
raise NotFoundError(
1170+
headers=dict(_response.headers),
1171+
body=typing.cast(
1172+
typing.Optional[typing.Any],
1173+
construct_type(
1174+
type_=typing.Optional[typing.Any], # type: ignore
1175+
object_=_response.json(),
1176+
),
1177+
),
1178+
)
1179+
if _response.status_code == 422:
1180+
raise UnprocessableEntityError(
1181+
headers=dict(_response.headers),
1182+
body=typing.cast(
1183+
typing.Optional[typing.Any],
1184+
construct_type(
1185+
type_=typing.Optional[typing.Any], # type: ignore
1186+
object_=_response.json(),
1187+
),
1188+
),
1189+
)
1190+
_response_json = _response.json()
1191+
except JSONDecodeError:
1192+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
1193+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
1194+
1195+
async def rollback_skill(
1196+
self, skill_id: str, *, request_options: typing.Optional[RequestOptions] = None
1197+
) -> AsyncHttpResponse[SkillResponse]:
1198+
"""
1199+
Rollback to the previous version (cannot be undone).
1200+
1201+
Parameters
1202+
----------
1203+
skill_id : str
1204+
1205+
request_options : typing.Optional[RequestOptions]
1206+
Request-specific configuration.
1207+
1208+
Returns
1209+
-------
1210+
AsyncHttpResponse[SkillResponse]
1211+
Successful Response
1212+
"""
1213+
_response = await self._client_wrapper.httpx_client.request(
1214+
f"skills/{jsonable_encoder(skill_id)}/rollback",
10731215
method="POST",
10741216
request_options=request_options,
10751217
)

src/browser_use_sdk/types/app_api_v2marketplace_skills_views_parameter_type.py

Lines changed: 0 additions & 7 deletions
This file was deleted.

src/browser_use_sdk/types/app_api_v2skills_views_parameter_type.py

Lines changed: 0 additions & 7 deletions
This file was deleted.

src/browser_use_sdk/types/app_api_v2skills_views_parameter_schema.py renamed to src/browser_use_sdk/types/cannot_rollback_public_skill_error.py

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,14 @@
55
import pydantic
66
from ..core.pydantic_utilities import IS_PYDANTIC_V2
77
from ..core.unchecked_base_model import UncheckedBaseModel
8-
from .app_api_v2skills_views_parameter_type import AppApiV2SkillsViewsParameterType
98

109

11-
class AppApiV2SkillsViewsParameterSchema(UncheckedBaseModel):
10+
class CannotRollbackPublicSkillError(UncheckedBaseModel):
1211
"""
13-
Schema for a skill parameter.
12+
Error response when trying to rollback a public skill
1413
"""
1514

16-
name: str
17-
type: AppApiV2SkillsViewsParameterType
18-
required: typing.Optional[bool] = None
19-
description: typing.Optional[str] = None
20-
default: typing.Optional[typing.Optional[typing.Any]] = None
15+
detail: typing.Optional[str] = None
2116

2217
if IS_PYDANTIC_V2:
2318
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2

0 commit comments

Comments
 (0)