Skip to content

Commit dc67b27

Browse files
feat(api): api update
1 parent 2868990 commit dc67b27

6 files changed

Lines changed: 265 additions & 18 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: 25
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/nen-labs%2Fsteel-f81cef6f87adc0530d9bc21e8d47c95aadef9d5bc3c282837ae0ad41d7f71bac.yml
3-
openapi_spec_hash: 5b273b225abb80a969ea1485bf399745
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/nen-labs%2Fsteel-66afe0a182177367bf01aad9b294babf46ae37d0b9979556b5a8900b7a27e5e5.yml
3+
openapi_spec_hash: 6d355b69499416dc264c8a26966f5db6
44
config_hash: 42515bf83f1e0e765071038fcf702122

src/steel/resources/sessions/sessions.py

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ def with_streaming_response(self) -> SessionsResourceWithStreamingResponse:
6565
def create(
6666
self,
6767
*,
68+
advanced_stealth: bool | NotGiven = NOT_GIVEN,
6869
block_ads: bool | NotGiven = NOT_GIVEN,
6970
concurrency: int | NotGiven = NOT_GIVEN,
7071
credentials: session_create_params.Credentials | NotGiven = NOT_GIVEN,
@@ -77,7 +78,7 @@ def create(
7778
session_id: str | NotGiven = NOT_GIVEN,
7879
solve_captcha: bool | NotGiven = NOT_GIVEN,
7980
api_timeout: int | NotGiven = NOT_GIVEN,
80-
use_proxy: bool | NotGiven = NOT_GIVEN,
81+
use_proxy: session_create_params.UseProxy | NotGiven = NOT_GIVEN,
8182
user_agent: str | NotGiven = NOT_GIVEN,
8283
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
8384
# The extra values given here take precedence over values defined on the client or passed to this method.
@@ -90,6 +91,8 @@ def create(
9091
Creates a new session with the provided configuration.
9192
9293
Args:
94+
advanced_stealth: Enable advanced stealth mode for the browser session. Default is false.
95+
9396
block_ads: Block ads in the browser session. Default is false.
9497
9598
concurrency: Number of sessions to create concurrently (check your plan limit)
@@ -118,8 +121,8 @@ def create(
118121
119122
api_timeout: Session timeout duration in milliseconds. Default is 300000 (5 minutes).
120123
121-
use_proxy: Enable Steel-provided residential proxy usage for the browser session. Default
122-
is false, which routes requests through datacenter proxies.
124+
use_proxy: Proxy configuration for the session. Can be a boolean or array of proxy
125+
configurations
123126
124127
user_agent: Custom user agent string for the browser session
125128
@@ -135,6 +138,7 @@ def create(
135138
"/v1/sessions",
136139
body=maybe_transform(
137140
{
141+
"advanced_stealth": advanced_stealth,
138142
"block_ads": block_ads,
139143
"concurrency": concurrency,
140144
"credentials": credentials,
@@ -421,6 +425,7 @@ def with_streaming_response(self) -> AsyncSessionsResourceWithStreamingResponse:
421425
async def create(
422426
self,
423427
*,
428+
advanced_stealth: bool | NotGiven = NOT_GIVEN,
424429
block_ads: bool | NotGiven = NOT_GIVEN,
425430
concurrency: int | NotGiven = NOT_GIVEN,
426431
credentials: session_create_params.Credentials | NotGiven = NOT_GIVEN,
@@ -433,7 +438,7 @@ async def create(
433438
session_id: str | NotGiven = NOT_GIVEN,
434439
solve_captcha: bool | NotGiven = NOT_GIVEN,
435440
api_timeout: int | NotGiven = NOT_GIVEN,
436-
use_proxy: bool | NotGiven = NOT_GIVEN,
441+
use_proxy: session_create_params.UseProxy | NotGiven = NOT_GIVEN,
437442
user_agent: str | NotGiven = NOT_GIVEN,
438443
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
439444
# The extra values given here take precedence over values defined on the client or passed to this method.
@@ -446,6 +451,8 @@ async def create(
446451
Creates a new session with the provided configuration.
447452
448453
Args:
454+
advanced_stealth: Enable advanced stealth mode for the browser session. Default is false.
455+
449456
block_ads: Block ads in the browser session. Default is false.
450457
451458
concurrency: Number of sessions to create concurrently (check your plan limit)
@@ -474,8 +481,8 @@ async def create(
474481
475482
api_timeout: Session timeout duration in milliseconds. Default is 300000 (5 minutes).
476483
477-
use_proxy: Enable Steel-provided residential proxy usage for the browser session. Default
478-
is false, which routes requests through datacenter proxies.
484+
use_proxy: Proxy configuration for the session. Can be a boolean or array of proxy
485+
configurations
479486
480487
user_agent: Custom user agent string for the browser session
481488
@@ -491,6 +498,7 @@ async def create(
491498
"/v1/sessions",
492499
body=await async_maybe_transform(
493500
{
501+
"advanced_stealth": advanced_stealth,
494502
"block_ads": block_ads,
495503
"concurrency": concurrency,
496504
"credentials": credentials,

src/steel/types/session.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@ class Session(BaseModel):
4444
proxy_bytes_used: int = FieldInfo(alias="proxyBytesUsed")
4545
"""Amount of data transmitted through the proxy"""
4646

47+
proxy_source: Optional[Literal["steel", "external"]] = FieldInfo(alias="proxySource", default=None)
48+
"""Source of the proxy used for the session"""
49+
4750
session_viewer_url: str = FieldInfo(alias="sessionViewerUrl")
4851
"""URL to view session details"""
4952

@@ -56,12 +59,12 @@ class Session(BaseModel):
5659
websocket_url: str = FieldInfo(alias="websocketUrl")
5760
"""URL for the session's WebSocket connection"""
5861

62+
advanced_stealth: Optional[bool] = FieldInfo(alias="advancedStealth", default=None)
63+
"""Indicates if advanced stealth mode is enabled"""
64+
5965
is_selenium: Optional[bool] = FieldInfo(alias="isSelenium", default=None)
6066
"""Indicates if Selenium is used in the session"""
6167

62-
proxy: Optional[str] = None
63-
"""Proxy server used for the session"""
64-
6568
region: Optional[Literal["lax", "ord", "iad", "bom", "scl", "fra", "hkg"]] = None
6669
"""The region where the session was created"""
6770

src/steel/types/session_create_params.py

Lines changed: 235 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
from typing import Dict, Union, Iterable
66
from datetime import datetime
7-
from typing_extensions import Literal, Required, Annotated, TypedDict
7+
from typing_extensions import Literal, Required, Annotated, TypeAlias, TypedDict
88

99
from .._utils import PropertyInfo
1010

@@ -19,10 +19,17 @@
1919
"SessionContextIndexedDBData",
2020
"SessionContextIndexedDBDataRecord",
2121
"SessionContextIndexedDBDataRecordBlobFile",
22+
"UseProxy",
23+
"UseProxyGeolocation",
24+
"UseProxyGeolocationGeolocation",
25+
"UseProxyServer",
2226
]
2327

2428

2529
class SessionCreateParams(TypedDict, total=False):
30+
advanced_stealth: Annotated[bool, PropertyInfo(alias="advancedStealth")]
31+
"""Enable advanced stealth mode for the browser session. Default is false."""
32+
2633
block_ads: Annotated[bool, PropertyInfo(alias="blockAds")]
2734
"""Block ads in the browser session. Default is false."""
2835

@@ -69,10 +76,10 @@ class SessionCreateParams(TypedDict, total=False):
6976
api_timeout: Annotated[int, PropertyInfo(alias="timeout")]
7077
"""Session timeout duration in milliseconds. Default is 300000 (5 minutes)."""
7178

72-
use_proxy: Annotated[bool, PropertyInfo(alias="useProxy")]
73-
"""Enable Steel-provided residential proxy usage for the browser session.
79+
use_proxy: Annotated[UseProxy, PropertyInfo(alias="useProxy")]
80+
"""Proxy configuration for the session.
7481
75-
Default is false, which routes requests through datacenter proxies.
82+
Can be a boolean or array of proxy configurations
7683
"""
7784

7885
user_agent: Annotated[str, PropertyInfo(alias="userAgent")]
@@ -209,3 +216,227 @@ class SessionContext(TypedDict, total=False):
209216

210217
session_storage: Annotated[Dict[str, Dict[str, str]], PropertyInfo(alias="sessionStorage")]
211218
"""Domain-specific sessionStorage items to initialize in the session"""
219+
220+
221+
class UseProxyGeolocationGeolocation(TypedDict, total=False):
222+
country: Required[
223+
Literal[
224+
"US",
225+
"CA",
226+
"MX",
227+
"GB",
228+
"DE",
229+
"FR",
230+
"IT",
231+
"ES",
232+
"PL",
233+
"NL",
234+
"SE",
235+
"NO",
236+
"DK",
237+
"FI",
238+
"CH",
239+
"AT",
240+
"BE",
241+
"IE",
242+
"PT",
243+
"GR",
244+
"CZ",
245+
"HU",
246+
"RO",
247+
"BG",
248+
"SK",
249+
"SI",
250+
"HR",
251+
"EE",
252+
"LV",
253+
"LT",
254+
"LU",
255+
"MT",
256+
"CY",
257+
"IS",
258+
"LI",
259+
"MC",
260+
"SM",
261+
"VA",
262+
"JP",
263+
"KR",
264+
"CN",
265+
"HK",
266+
"TW",
267+
"SG",
268+
"AU",
269+
"NZ",
270+
"IN",
271+
"TH",
272+
"MY",
273+
"PH",
274+
"ID",
275+
"VN",
276+
"AF",
277+
"BD",
278+
"BN",
279+
"KH",
280+
"LA",
281+
"LK",
282+
"MM",
283+
"NP",
284+
"PK",
285+
"FJ",
286+
"PG",
287+
"AE",
288+
"SA",
289+
"IL",
290+
"TR",
291+
"IR",
292+
"IQ",
293+
"JO",
294+
"KW",
295+
"LB",
296+
"OM",
297+
"QA",
298+
"BH",
299+
"YE",
300+
"SY",
301+
"ZA",
302+
"EG",
303+
"MA",
304+
"NG",
305+
"KE",
306+
"DZ",
307+
"AO",
308+
"BW",
309+
"ET",
310+
"GH",
311+
"CI",
312+
"LY",
313+
"MZ",
314+
"RW",
315+
"SN",
316+
"TN",
317+
"UG",
318+
"ZM",
319+
"ZW",
320+
"TZ",
321+
"MU",
322+
"SC",
323+
"BR",
324+
"AR",
325+
"CL",
326+
"CO",
327+
"PE",
328+
"VE",
329+
"EC",
330+
"UY",
331+
"PY",
332+
"BO",
333+
"CR",
334+
"CU",
335+
"DO",
336+
"GT",
337+
"HN",
338+
"JM",
339+
"NI",
340+
"PA",
341+
"SV",
342+
"TT",
343+
"BB",
344+
"BZ",
345+
"GY",
346+
"SR",
347+
"RU",
348+
"UA",
349+
"BY",
350+
"KZ",
351+
"UZ",
352+
"AZ",
353+
"GE",
354+
"AM",
355+
"MD",
356+
"MK",
357+
"AL",
358+
"BA",
359+
"RS",
360+
"ME",
361+
"XK",
362+
"MN",
363+
"KG",
364+
"TJ",
365+
"TM",
366+
]
367+
]
368+
"""Country code (e.g., 'US', 'GB', 'DE') - ISO 3166-1 alpha-2"""
369+
370+
city: str
371+
"""City name (e.g., 'NEW_YORK', 'LOS_ANGELES')"""
372+
373+
state: Literal[
374+
"AL",
375+
"AK",
376+
"AZ",
377+
"AR",
378+
"CA",
379+
"CO",
380+
"CT",
381+
"DE",
382+
"FL",
383+
"GA",
384+
"HI",
385+
"ID",
386+
"IL",
387+
"IN",
388+
"IA",
389+
"KS",
390+
"KY",
391+
"LA",
392+
"ME",
393+
"MD",
394+
"MA",
395+
"MI",
396+
"MN",
397+
"MS",
398+
"MO",
399+
"MT",
400+
"NE",
401+
"NV",
402+
"NH",
403+
"NJ",
404+
"NM",
405+
"NY",
406+
"NC",
407+
"ND",
408+
"OH",
409+
"OK",
410+
"OR",
411+
"PA",
412+
"RI",
413+
"SC",
414+
"SD",
415+
"TN",
416+
"TX",
417+
"UT",
418+
"VT",
419+
"VA",
420+
"WA",
421+
"WV",
422+
"WI",
423+
"WY",
424+
"DC",
425+
"PR",
426+
"GU",
427+
"VI",
428+
]
429+
"""State code (e.g., 'NY', 'CA') - US states only"""
430+
431+
432+
class UseProxyGeolocation(TypedDict, total=False):
433+
geolocation: Required[UseProxyGeolocationGeolocation]
434+
"""Geographic location for the proxy"""
435+
436+
437+
class UseProxyServer(TypedDict, total=False):
438+
server: Required[str]
439+
"""Proxy server URL"""
440+
441+
442+
UseProxy: TypeAlias = Union[bool, UseProxyGeolocation, UseProxyServer, object]

0 commit comments

Comments
 (0)