Skip to content

Commit fdb020d

Browse files
feat: Add region as a first-class API field with plan and flag gating
Stainless-Generated-From: 91d0b1968ff1d553bd8eb0700df9b6c8d9167bce
1 parent 9ff1b44 commit fdb020d

15 files changed

Lines changed: 100 additions & 3 deletions

src/kernel/resources/browser_pools.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from __future__ import annotations
44

55
from typing import Dict, Iterable, Optional
6+
from typing_extensions import Literal
67

78
import httpx
89

@@ -70,6 +71,7 @@ def create(
7071
profile: browser_pool_create_params.Profile | Omit = omit,
7172
proxy_id: str | Omit = omit,
7273
refresh_on_profile_update: bool | Omit = omit,
74+
region: Literal["us-east", "eu-west"] | Omit = omit,
7375
start_url: str | Omit = omit,
7476
stealth: bool | Omit = omit,
7577
telemetry: Optional[browser_pool_create_params.Telemetry] | Omit = omit,
@@ -126,6 +128,10 @@ def create(
126128
pool browsers pick up the latest profile data. When a profile is provided during
127129
creation, this defaults to true. Requires a profile to be set on the pool.
128130
131+
region: Geographic region for the browser pool. It is fixed once the pool is created.
132+
Region selection requires a Start-Up or Enterprise plan, defaults to us-east
133+
when omitted on create.
134+
129135
start_url: Optional URL to navigate to when a new browser is warmed into the pool.
130136
Best-effort: failures to navigate do not fail pool fill. Only applied to
131137
newly-warmed browsers; browsers reused via release/acquire keep whatever URL the
@@ -180,6 +186,7 @@ def create(
180186
"profile": profile,
181187
"proxy_id": proxy_id,
182188
"refresh_on_profile_update": refresh_on_profile_update,
189+
"region": region,
183190
"start_url": start_url,
184191
"stealth": stealth,
185192
"telemetry": telemetry,
@@ -386,6 +393,7 @@ def list(
386393
name: str | Omit = omit,
387394
offset: int | Omit = omit,
388395
query: str | Omit = omit,
396+
region: Literal["us-east", "eu-west"] | Omit = omit,
389397
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
390398
# The extra values given here take precedence over values defined on the client or passed to this method.
391399
extra_headers: Headers | None = None,
@@ -409,6 +417,8 @@ def list(
409417
query: Case-insensitive substring match against browser pool name. IDs match by exact
410418
value.
411419
420+
region: Filter pools by geographic region. Omit to list pools in all regions.
421+
412422
extra_headers: Send extra headers
413423
414424
extra_query: Add additional query parameters to the request
@@ -431,6 +441,7 @@ def list(
431441
"name": name,
432442
"offset": offset,
433443
"query": query,
444+
"region": region,
434445
},
435446
browser_pool_list_params.BrowserPoolListParams,
436447
),
@@ -678,6 +689,7 @@ async def create(
678689
profile: browser_pool_create_params.Profile | Omit = omit,
679690
proxy_id: str | Omit = omit,
680691
refresh_on_profile_update: bool | Omit = omit,
692+
region: Literal["us-east", "eu-west"] | Omit = omit,
681693
start_url: str | Omit = omit,
682694
stealth: bool | Omit = omit,
683695
telemetry: Optional[browser_pool_create_params.Telemetry] | Omit = omit,
@@ -734,6 +746,10 @@ async def create(
734746
pool browsers pick up the latest profile data. When a profile is provided during
735747
creation, this defaults to true. Requires a profile to be set on the pool.
736748
749+
region: Geographic region for the browser pool. It is fixed once the pool is created.
750+
Region selection requires a Start-Up or Enterprise plan, defaults to us-east
751+
when omitted on create.
752+
737753
start_url: Optional URL to navigate to when a new browser is warmed into the pool.
738754
Best-effort: failures to navigate do not fail pool fill. Only applied to
739755
newly-warmed browsers; browsers reused via release/acquire keep whatever URL the
@@ -788,6 +804,7 @@ async def create(
788804
"profile": profile,
789805
"proxy_id": proxy_id,
790806
"refresh_on_profile_update": refresh_on_profile_update,
807+
"region": region,
791808
"start_url": start_url,
792809
"stealth": stealth,
793810
"telemetry": telemetry,
@@ -994,6 +1011,7 @@ def list(
9941011
name: str | Omit = omit,
9951012
offset: int | Omit = omit,
9961013
query: str | Omit = omit,
1014+
region: Literal["us-east", "eu-west"] | Omit = omit,
9971015
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
9981016
# The extra values given here take precedence over values defined on the client or passed to this method.
9991017
extra_headers: Headers | None = None,
@@ -1017,6 +1035,8 @@ def list(
10171035
query: Case-insensitive substring match against browser pool name. IDs match by exact
10181036
value.
10191037
1038+
region: Filter pools by geographic region. Omit to list pools in all regions.
1039+
10201040
extra_headers: Send extra headers
10211041
10221042
extra_query: Add additional query parameters to the request
@@ -1039,6 +1059,7 @@ def list(
10391059
"name": name,
10401060
"offset": offset,
10411061
"query": query,
1062+
"region": region,
10421063
},
10431064
browser_pool_list_params.BrowserPoolListParams,
10441065
),

src/kernel/resources/browsers/browsers.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,7 @@ def create(
175175
profile: BrowserProfile | Omit = omit,
176176
proxy: BrowserProxyConfigParam | Omit = omit,
177177
proxy_id: str | Omit = omit,
178+
region: Literal["us-east", "eu-west"] | Omit = omit,
178179
start_url: str | Omit = omit,
179180
stealth: bool | Omit = omit,
180181
tags: TagsParam | Omit = omit,
@@ -229,6 +230,10 @@ def create(
229230
proxy_id: Optional proxy to associate to the browser session. Must reference a proxy in
230231
the same project as the browser session. Deprecated in favor of proxy.
231232
233+
region: Geographic region for the browser session. It is fixed once the session is
234+
created. Region selection requires a Start-Up or Enterprise plan, defaults to
235+
us-east when omitted on create.
236+
232237
start_url: Optional URL to open when the browser session is created. Navigation is
233238
best-effort, so navigation failures do not prevent the session from being
234239
created.
@@ -290,6 +295,7 @@ def create(
290295
"profile": profile,
291296
"proxy": proxy,
292297
"proxy_id": proxy_id,
298+
"region": region,
293299
"start_url": start_url,
294300
"stealth": stealth,
295301
"tags": tags,
@@ -440,6 +446,7 @@ def list(
440446
limit: int | Omit = omit,
441447
offset: int | Omit = omit,
442448
query: str | Omit = omit,
449+
region: Literal["us-east", "eu-west"] | Omit = omit,
443450
status: Literal["active", "deleted", "all"] | Omit = omit,
444451
tags: Dict[str, str] | Omit = omit,
445452
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
@@ -464,6 +471,8 @@ def list(
464471
465472
query: Search browsers by name, session ID, profile name or ID, proxy ID, or pool name.
466473
474+
region: Filter sessions by geographic region. Omit to list sessions in all regions.
475+
467476
status: Filter sessions by status. "active" returns only active sessions (default),
468477
"deleted" returns only soft-deleted sessions, "all" returns both.
469478
@@ -493,6 +502,7 @@ def list(
493502
"limit": limit,
494503
"offset": offset,
495504
"query": query,
505+
"region": region,
496506
"status": status,
497507
"tags": tags,
498508
},
@@ -775,6 +785,7 @@ async def create(
775785
profile: BrowserProfile | Omit = omit,
776786
proxy: BrowserProxyConfigParam | Omit = omit,
777787
proxy_id: str | Omit = omit,
788+
region: Literal["us-east", "eu-west"] | Omit = omit,
778789
start_url: str | Omit = omit,
779790
stealth: bool | Omit = omit,
780791
tags: TagsParam | Omit = omit,
@@ -829,6 +840,10 @@ async def create(
829840
proxy_id: Optional proxy to associate to the browser session. Must reference a proxy in
830841
the same project as the browser session. Deprecated in favor of proxy.
831842
843+
region: Geographic region for the browser session. It is fixed once the session is
844+
created. Region selection requires a Start-Up or Enterprise plan, defaults to
845+
us-east when omitted on create.
846+
832847
start_url: Optional URL to open when the browser session is created. Navigation is
833848
best-effort, so navigation failures do not prevent the session from being
834849
created.
@@ -890,6 +905,7 @@ async def create(
890905
"profile": profile,
891906
"proxy": proxy,
892907
"proxy_id": proxy_id,
908+
"region": region,
893909
"start_url": start_url,
894910
"stealth": stealth,
895911
"tags": tags,
@@ -1040,6 +1056,7 @@ def list(
10401056
limit: int | Omit = omit,
10411057
offset: int | Omit = omit,
10421058
query: str | Omit = omit,
1059+
region: Literal["us-east", "eu-west"] | Omit = omit,
10431060
status: Literal["active", "deleted", "all"] | Omit = omit,
10441061
tags: Dict[str, str] | Omit = omit,
10451062
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
@@ -1064,6 +1081,8 @@ def list(
10641081
10651082
query: Search browsers by name, session ID, profile name or ID, proxy ID, or pool name.
10661083
1084+
region: Filter sessions by geographic region. Omit to list sessions in all regions.
1085+
10671086
status: Filter sessions by status. "active" returns only active sessions (default),
10681087
"deleted" returns only soft-deleted sessions, "all" returns both.
10691088
@@ -1093,6 +1112,7 @@ def list(
10931112
"limit": limit,
10941113
"offset": offset,
10951114
"query": query,
1115+
"region": region,
10961116
"status": status,
10971117
"tags": tags,
10981118
},

src/kernel/types/browser_create_params.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from __future__ import annotations
44

55
from typing import Dict, Iterable, Optional
6-
from typing_extensions import TypedDict
6+
from typing_extensions import Literal, TypedDict
77

88
from .tags_param import TagsParam
99
from .browser_proxy_config_param import BrowserProxyConfigParam
@@ -90,6 +90,13 @@ class BrowserCreateParams(TypedDict, total=False):
9090
favor of proxy.
9191
"""
9292

93+
region: Literal["us-east", "eu-west"]
94+
"""Geographic region for the browser session.
95+
96+
It is fixed once the session is created. Region selection requires a Start-Up or
97+
Enterprise plan, defaults to us-east when omitted on create.
98+
"""
99+
93100
start_url: str
94101
"""Optional URL to open when the browser session is created.
95102

src/kernel/types/browser_create_response.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
from typing import Dict, Optional
44
from datetime import datetime
5+
from typing_extensions import Literal
56

67
from .tags import Tags
78
from .profile import Profile
@@ -25,6 +26,9 @@ class BrowserCreateResponse(BaseModel):
2526
headless: bool
2627
"""Whether the browser session is running in headless mode."""
2728

29+
region: Literal["us-east", "eu-west"]
30+
"""Geographic region of the browser session. Fixed once the session is created."""
31+
2832
session_id: str
2933
"""Unique identifier for the browser session"""
3034

src/kernel/types/browser_list_params.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ class BrowserListParams(TypedDict, total=False):
2727
Search browsers by name, session ID, profile name or ID, proxy ID, or pool name.
2828
"""
2929

30+
region: Literal["us-east", "eu-west"]
31+
"""Filter sessions by geographic region. Omit to list sessions in all regions."""
32+
3033
status: Literal["active", "deleted", "all"]
3134
"""Filter sessions by status.
3235

src/kernel/types/browser_list_response.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
from typing import Dict, Optional
44
from datetime import datetime
5+
from typing_extensions import Literal
56

67
from .tags import Tags
78
from .profile import Profile
@@ -25,6 +26,9 @@ class BrowserListResponse(BaseModel):
2526
headless: bool
2627
"""Whether the browser session is running in headless mode."""
2728

29+
region: Literal["us-east", "eu-west"]
30+
"""Geographic region of the browser session. Fixed once the session is created."""
31+
2832
session_id: str
2933
"""Unique identifier for the browser session"""
3034

src/kernel/types/browser_pool.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
from typing import Dict, List, Optional
44
from datetime import datetime
5+
from typing_extensions import Literal
56

67
from .._models import BaseModel
78
from .shared.browser_viewport import BrowserViewport
@@ -166,6 +167,9 @@ class BrowserPool(BaseModel):
166167
(echoed as sent on create).
167168
"""
168169

170+
region: Literal["us-east", "eu-west"]
171+
"""Geographic region of the browser pool. Fixed once the pool is created."""
172+
169173
name: Optional[str] = None
170174
"""Browser pool name, if set"""
171175

src/kernel/types/browser_pool_acquire_response.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
from typing import Dict, Optional
44
from datetime import datetime
5+
from typing_extensions import Literal
56

67
from .tags import Tags
78
from .profile import Profile
@@ -25,6 +26,9 @@ class BrowserPoolAcquireResponse(BaseModel):
2526
headless: bool
2627
"""Whether the browser session is running in headless mode."""
2728

29+
region: Literal["us-east", "eu-west"]
30+
"""Geographic region of the browser session. Fixed once the session is created."""
31+
2832
session_id: str
2933
"""Unique identifier for the browser session"""
3034

src/kernel/types/browser_pool_create_params.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from __future__ import annotations
44

55
from typing import Dict, Iterable, Optional
6-
from typing_extensions import Required, TypedDict
6+
from typing_extensions import Literal, Required, TypedDict
77

88
from .shared_params.browser_viewport import BrowserViewport
99
from .shared_params.browser_extension import BrowserExtension
@@ -83,6 +83,13 @@ class BrowserPoolCreateParams(TypedDict, total=False):
8383
creation, this defaults to true. Requires a profile to be set on the pool.
8484
"""
8585

86+
region: Literal["us-east", "eu-west"]
87+
"""Geographic region for the browser pool.
88+
89+
It is fixed once the pool is created. Region selection requires a Start-Up or
90+
Enterprise plan, defaults to us-east when omitted on create.
91+
"""
92+
8693
start_url: str
8794
"""Optional URL to navigate to when a new browser is warmed into the pool.
8895

src/kernel/types/browser_pool_list_params.py

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

33
from __future__ import annotations
44

5-
from typing_extensions import TypedDict
5+
from typing_extensions import Literal, TypedDict
66

77
__all__ = ["BrowserPoolListParams"]
88

@@ -27,3 +27,6 @@ class BrowserPoolListParams(TypedDict, total=False):
2727
2828
IDs match by exact value.
2929
"""
30+
31+
region: Literal["us-east", "eu-west"]
32+
"""Filter pools by geographic region. Omit to list pools in all regions."""

0 commit comments

Comments
 (0)