Skip to content

Commit d41b2b0

Browse files
feat(api): api update
1 parent c931375 commit d41b2b0

4 files changed

Lines changed: 26 additions & 2 deletions

File tree

‎.stats.yml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 22
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-f27c9584f74632a8c9603fce7190e3f63275a4ec4030da2a9475efb619618b3f.yml
3-
openapi_spec_hash: 224cb935536a4d999d9683f8c03ea32f
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-9cbf61fcc1963e0a895575e95d6d57101ceebd06e7e83b2e6ab2e6559921d8b9.yml
3+
openapi_spec_hash: 3e687221fe05e917a1c5b622afd17103
44
config_hash: ff13935d1231ad44cd3822ffe39904b4

‎src/context/dev/resources/web.py‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,7 @@ def screenshot(
180180
direct_url: str | Omit = omit,
181181
domain: str | Omit = omit,
182182
full_screenshot: Literal["true", "false"] | Omit = omit,
183+
handle_cookie_popup: Literal["true", "false"] | Omit = omit,
183184
max_age_ms: int | Omit = omit,
184185
page: Literal["login", "signup", "blog", "careers", "pricing", "terms", "privacy", "contact"] | Omit = omit,
185186
timeout_ms: int | Omit = omit,
@@ -208,6 +209,11 @@ def screenshot(
208209
screenshot capturing all content. If 'false' or not provided, takes a viewport
209210
screenshot (standard browser view).
210211
212+
handle_cookie_popup: Optional parameter to control cookie/consent popup handling. If 'true', the
213+
browser service dismisses cookie consent before capture. If 'false' or not
214+
provided, captures the page without that step. This value is part of the
215+
screenshot cache key.
216+
211217
max_age_ms: Return a cached screenshot if a prior screenshot for the same parameters exists
212218
and is younger than this many milliseconds. Defaults to 1 day (86400000 ms) when
213219
omitted. Max is 30 days (2592000000 ms). Set to 0 to always capture fresh.
@@ -248,6 +254,7 @@ def screenshot(
248254
"direct_url": direct_url,
249255
"domain": domain,
250256
"full_screenshot": full_screenshot,
257+
"handle_cookie_popup": handle_cookie_popup,
251258
"max_age_ms": max_age_ms,
252259
"page": page,
253260
"timeout_ms": timeout_ms,
@@ -790,6 +797,7 @@ async def screenshot(
790797
direct_url: str | Omit = omit,
791798
domain: str | Omit = omit,
792799
full_screenshot: Literal["true", "false"] | Omit = omit,
800+
handle_cookie_popup: Literal["true", "false"] | Omit = omit,
793801
max_age_ms: int | Omit = omit,
794802
page: Literal["login", "signup", "blog", "careers", "pricing", "terms", "privacy", "contact"] | Omit = omit,
795803
timeout_ms: int | Omit = omit,
@@ -818,6 +826,11 @@ async def screenshot(
818826
screenshot capturing all content. If 'false' or not provided, takes a viewport
819827
screenshot (standard browser view).
820828
829+
handle_cookie_popup: Optional parameter to control cookie/consent popup handling. If 'true', the
830+
browser service dismisses cookie consent before capture. If 'false' or not
831+
provided, captures the page without that step. This value is part of the
832+
screenshot cache key.
833+
821834
max_age_ms: Return a cached screenshot if a prior screenshot for the same parameters exists
822835
and is younger than this many milliseconds. Defaults to 1 day (86400000 ms) when
823836
omitted. Max is 30 days (2592000000 ms). Set to 0 to always capture fresh.
@@ -858,6 +871,7 @@ async def screenshot(
858871
"direct_url": direct_url,
859872
"domain": domain,
860873
"full_screenshot": full_screenshot,
874+
"handle_cookie_popup": handle_cookie_popup,
861875
"max_age_ms": max_age_ms,
862876
"page": page,
863877
"timeout_ms": timeout_ms,

‎src/context/dev/types/web_screenshot_params.py‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,14 @@ class WebScreenshotParams(TypedDict, total=False):
3131
provided, takes a viewport screenshot (standard browser view).
3232
"""
3333

34+
handle_cookie_popup: Annotated[Literal["true", "false"], PropertyInfo(alias="handleCookiePopup")]
35+
"""Optional parameter to control cookie/consent popup handling.
36+
37+
If 'true', the browser service dismisses cookie consent before capture. If
38+
'false' or not provided, captures the page without that step. This value is part
39+
of the screenshot cache key.
40+
"""
41+
3442
max_age_ms: Annotated[int, PropertyInfo(alias="maxAgeMs")]
3543
"""
3644
Return a cached screenshot if a prior screenshot for the same parameters exists

‎tests/api_resources/test_web.py‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ def test_method_screenshot_with_all_params(self, client: ContextDev) -> None:
115115
direct_url="https://example.com",
116116
domain="domain",
117117
full_screenshot="true",
118+
handle_cookie_popup="true",
118119
max_age_ms=0,
119120
page="login",
120121
timeout_ms=1000,
@@ -505,6 +506,7 @@ async def test_method_screenshot_with_all_params(self, async_client: AsyncContex
505506
direct_url="https://example.com",
506507
domain="domain",
507508
full_screenshot="true",
509+
handle_cookie_popup="true",
508510
max_age_ms=0,
509511
page="login",
510512
timeout_ms=1000,

0 commit comments

Comments
 (0)