Skip to content

Commit 3e11311

Browse files
feat: api: support per-acquire start_url override on browser pool acquire
1 parent 57eb393 commit 3e11311

4 files changed

Lines changed: 23 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: 122
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/kernel/kernel-7cde13c82c71b7a5fd64b592f853a7c999c0e0c02dce161e6126d0e99df3412b.yml
3-
openapi_spec_hash: 52cda226c70a248cbea3af6c52822b44
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/kernel/kernel-d9b82fc5346c9be1bf9c2b18792fdcdec6a80a86153ca765c9e93e597b46fa24.yml
3+
openapi_spec_hash: 9cbaab975acfa421b795d11aa635c57e
44
config_hash: 99b2b2a25e8067ad9c9214e38e01d64c

src/kernel/resources/browser_pools.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -427,6 +427,7 @@ def acquire(
427427
*,
428428
acquire_timeout_seconds: int | Omit = omit,
429429
name: str | Omit = omit,
430+
start_url: str | Omit = omit,
430431
tags: TagsParam | Omit = omit,
431432
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
432433
# The extra values given here take precedence over values defined on the client or passed to this method.
@@ -452,6 +453,10 @@ def acquire(
452453
project. Applies to this lease only and is cleared when the browser is released
453454
back to the pool.
454455
456+
start_url: Optional URL to navigate the acquired browser to. Overrides the pool's start_url
457+
for this acquire only. Best-effort: failures to navigate do not fail the
458+
acquire.
459+
455460
tags: Optional user-defined key-value tags for the acquired browser session, used to
456461
find and group sessions later. Applies to this lease only and are cleared when
457462
the browser is released back to the pool. Up to 50 pairs.
@@ -472,6 +477,7 @@ def acquire(
472477
{
473478
"acquire_timeout_seconds": acquire_timeout_seconds,
474479
"name": name,
480+
"start_url": start_url,
475481
"tags": tags,
476482
},
477483
browser_pool_acquire_params.BrowserPoolAcquireParams,
@@ -956,6 +962,7 @@ async def acquire(
956962
*,
957963
acquire_timeout_seconds: int | Omit = omit,
958964
name: str | Omit = omit,
965+
start_url: str | Omit = omit,
959966
tags: TagsParam | Omit = omit,
960967
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
961968
# The extra values given here take precedence over values defined on the client or passed to this method.
@@ -981,6 +988,10 @@ async def acquire(
981988
project. Applies to this lease only and is cleared when the browser is released
982989
back to the pool.
983990
991+
start_url: Optional URL to navigate the acquired browser to. Overrides the pool's start_url
992+
for this acquire only. Best-effort: failures to navigate do not fail the
993+
acquire.
994+
984995
tags: Optional user-defined key-value tags for the acquired browser session, used to
985996
find and group sessions later. Applies to this lease only and are cleared when
986997
the browser is released back to the pool. Up to 50 pairs.
@@ -1001,6 +1012,7 @@ async def acquire(
10011012
{
10021013
"acquire_timeout_seconds": acquire_timeout_seconds,
10031014
"name": name,
1015+
"start_url": start_url,
10041016
"tags": tags,
10051017
},
10061018
browser_pool_acquire_params.BrowserPoolAcquireParams,

src/kernel/types/browser_pool_acquire_params.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,13 @@ class BrowserPoolAcquireParams(TypedDict, total=False):
2525
back to the pool.
2626
"""
2727

28+
start_url: str
29+
"""Optional URL to navigate the acquired browser to.
30+
31+
Overrides the pool's start_url for this acquire only. Best-effort: failures to
32+
navigate do not fail the acquire.
33+
"""
34+
2835
tags: TagsParam
2936
"""
3037
Optional user-defined key-value tags for the acquired browser session, used to

tests/api_resources/test_browser_pools.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,7 @@ def test_method_acquire_with_all_params(self, client: Kernel) -> None:
311311
id_or_name="id_or_name",
312312
acquire_timeout_seconds=0,
313313
name="checkout-flow-1",
314+
start_url="https://example.com",
314315
tags={
315316
"team": "backend",
316317
"env": "staging",
@@ -746,6 +747,7 @@ async def test_method_acquire_with_all_params(self, async_client: AsyncKernel) -
746747
id_or_name="id_or_name",
747748
acquire_timeout_seconds=0,
748749
name="checkout-flow-1",
750+
start_url="https://example.com",
749751
tags={
750752
"team": "backend",
751753
"env": "staging",

0 commit comments

Comments
 (0)