Skip to content

Commit 53ca6ee

Browse files
feat: add force flag to viewport resize to bypass live view/recording check
1 parent 46c100f commit 53ca6ee

File tree

4 files changed

+20
-6
lines changed

4 files changed

+20
-6
lines changed

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 103
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/kernel%2Fkernel-2ba004ce5444b5f8abe3bcf66fd7c6da394bc964e8b2bf197576841135a48046.yml
3-
openapi_spec_hash: f156ea2ae35e4d148704c6e4ce051239
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/kernel%2Fkernel-ef24d4bf172555bcbe8e3b432c644a25a1c6afd99c958a2eda8c3b1ea9568113.yml
3+
openapi_spec_hash: b603c5a983e837928fa7d1100ed64fc9
44
config_hash: cff4d43372b6fa66b64e2d4150f6aa76

src/kernel/resources/browsers/browsers.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ def update(
284284
*,
285285
profile: BrowserProfile | Omit = omit,
286286
proxy_id: Optional[str] | Omit = omit,
287-
viewport: BrowserViewport | Omit = omit,
287+
viewport: browser_update_params.Viewport | Omit = omit,
288288
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
289289
# The extra values given here take precedence over values defined on the client or passed to this method.
290290
extra_headers: Headers | None = None,
@@ -711,7 +711,7 @@ async def update(
711711
*,
712712
profile: BrowserProfile | Omit = omit,
713713
proxy_id: Optional[str] | Omit = omit,
714-
viewport: BrowserViewport | Omit = omit,
714+
viewport: browser_update_params.Viewport | Omit = omit,
715715
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
716716
# The extra values given here take precedence over values defined on the client or passed to this method.
717717
extra_headers: Headers | None = None,

src/kernel/types/browser_update_params.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from .shared_params.browser_profile import BrowserProfile
99
from .shared_params.browser_viewport import BrowserViewport
1010

11-
__all__ = ["BrowserUpdateParams"]
11+
__all__ = ["BrowserUpdateParams", "Viewport"]
1212

1313

1414
class BrowserUpdateParams(TypedDict, total=False):
@@ -24,5 +24,17 @@ class BrowserUpdateParams(TypedDict, total=False):
2424
Omit to leave unchanged, set to empty string to remove proxy.
2525
"""
2626

27-
viewport: BrowserViewport
27+
viewport: Viewport
2828
"""Viewport configuration to apply to the browser session."""
29+
30+
31+
class Viewport(BrowserViewport, total=False):
32+
"""Viewport configuration to apply to the browser session."""
33+
34+
force: bool
35+
"""
36+
If true, allow the viewport change even when a live view or recording/replay is
37+
active. Active recordings will be gracefully stopped and restarted at the new
38+
resolution as separate segments. If false (default), the resize is refused when
39+
a live view or recording is active.
40+
"""

tests/api_resources/test_browsers.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@ def test_method_update_with_all_params(self, client: Kernel) -> None:
158158
"height": 800,
159159
"width": 1280,
160160
"refresh_rate": 60,
161+
"force": True,
161162
},
162163
)
163164
assert_matches_type(BrowserUpdateResponse, browser, path=["response"])
@@ -521,6 +522,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncKernel) ->
521522
"height": 800,
522523
"width": 1280,
523524
"refresh_rate": 60,
525+
"force": True,
524526
},
525527
)
526528
assert_matches_type(BrowserUpdateResponse, browser, path=["response"])

0 commit comments

Comments
 (0)