Skip to content

Commit de03f2d

Browse files
feat(api): api update
1 parent 6bcebb1 commit de03f2d

4 files changed

Lines changed: 212 additions & 23 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: 17
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/nen-labs%2Fsteel-c8306e25d5c8e0d16318b9d44a683dd3d10f8d8b3d56ecbd1952d7f9e95d7f08.yml
3-
openapi_spec_hash: 9877212f13f31009e05d8a1f8b2dd750
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/nen-labs%2Fsteel-df307c8d4d17c23d37054bf05f4d0a154be8011730c73ef8b3cfc987bcbdc05e.yml
3+
openapi_spec_hash: f3227dde2385091c20c58a17621286c7
44
config_hash: f23d5011c9a89d67725b48e96ffb7c99

src/steel/types/session_context.py

Lines changed: 66 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,36 @@
11
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
22

33
from typing import Dict, List, Optional
4+
from datetime import datetime
45
from typing_extensions import Literal
56

67
from pydantic import Field as FieldInfo
78

89
from .._models import BaseModel
910

10-
__all__ = ["SessionContext", "Cookie"]
11+
__all__ = [
12+
"SessionContext",
13+
"Cookie",
14+
"CookiePartitionKey",
15+
"IndexedDB",
16+
"IndexedDBData",
17+
"IndexedDBDataRecord",
18+
"IndexedDBDataRecordBlobFile",
19+
]
20+
21+
22+
class CookiePartitionKey(BaseModel):
23+
has_cross_site_ancestor: bool = FieldInfo(alias="hasCrossSiteAncestor")
24+
"""
25+
Indicates if the cookie has any ancestors that are cross-site to the
26+
topLevelSite.
27+
"""
28+
29+
top_level_site: str = FieldInfo(alias="topLevelSite")
30+
"""
31+
The site of the top-level URL the browser was visiting at the start of the
32+
request to the endpoint that set the cookie.
33+
"""
1134

1235

1336
class Cookie(BaseModel):
@@ -26,7 +49,7 @@ class Cookie(BaseModel):
2649
http_only: Optional[bool] = FieldInfo(alias="httpOnly", default=None)
2750
"""Whether the cookie is HTTP only"""
2851

29-
partition_key: Optional[str] = FieldInfo(alias="partitionKey", default=None)
52+
partition_key: Optional[CookiePartitionKey] = FieldInfo(alias="partitionKey", default=None)
3053
"""The partition key of the cookie"""
3154

3255
path: Optional[str] = None
@@ -60,15 +83,53 @@ class Cookie(BaseModel):
6083
"""The URL of the cookie"""
6184

6285

86+
class IndexedDBDataRecordBlobFile(BaseModel):
87+
blob_number: float = FieldInfo(alias="blobNumber")
88+
89+
mime_type: str = FieldInfo(alias="mimeType")
90+
91+
size: float
92+
93+
filename: Optional[str] = None
94+
95+
last_modified: Optional[datetime] = FieldInfo(alias="lastModified", default=None)
96+
97+
path: Optional[str] = None
98+
99+
100+
class IndexedDBDataRecord(BaseModel):
101+
blob_files: Optional[List[IndexedDBDataRecordBlobFile]] = FieldInfo(alias="blobFiles", default=None)
102+
103+
key: Optional[object] = None
104+
105+
value: Optional[object] = None
106+
107+
108+
class IndexedDBData(BaseModel):
109+
id: float
110+
111+
name: str
112+
113+
records: List[IndexedDBDataRecord]
114+
115+
116+
class IndexedDB(BaseModel):
117+
id: float
118+
119+
data: List[IndexedDBData]
120+
121+
name: str
122+
123+
63124
class SessionContext(BaseModel):
64125
cookies: Optional[List[Cookie]] = None
65126
"""Cookies to initialize in the session"""
66127

67-
indexed_db: Optional[Dict[str, List[Dict[str, object]]]] = FieldInfo(alias="indexedDB", default=None)
128+
indexed_db: Optional[Dict[str, List[IndexedDB]]] = FieldInfo(alias="indexedDB", default=None)
68129
"""Domain-specific indexedDB items to initialize in the session"""
69130

70-
local_storage: Optional[Dict[str, Dict[str, object]]] = FieldInfo(alias="localStorage", default=None)
131+
local_storage: Optional[Dict[str, Dict[str, str]]] = FieldInfo(alias="localStorage", default=None)
71132
"""Domain-specific localStorage items to initialize in the session"""
72133

73-
session_storage: Optional[Dict[str, Dict[str, object]]] = FieldInfo(alias="sessionStorage", default=None)
134+
session_storage: Optional[Dict[str, Dict[str, str]]] = FieldInfo(alias="sessionStorage", default=None)
74135
"""Domain-specific sessionStorage items to initialize in the session"""

src/steel/types/session_create_params.py

Lines changed: 69 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,23 @@
22

33
from __future__ import annotations
44

5-
from typing import Dict, Iterable
5+
from typing import Dict, Union, Iterable
6+
from datetime import datetime
67
from typing_extensions import Literal, Required, Annotated, TypedDict
78

89
from .._utils import PropertyInfo
910

10-
__all__ = ["SessionCreateParams", "Dimensions", "SessionContext", "SessionContextCookie"]
11+
__all__ = [
12+
"SessionCreateParams",
13+
"Dimensions",
14+
"SessionContext",
15+
"SessionContextCookie",
16+
"SessionContextCookiePartitionKey",
17+
"SessionContextIndexedDB",
18+
"SessionContextIndexedDBData",
19+
"SessionContextIndexedDBDataRecord",
20+
"SessionContextIndexedDBDataRecordBlobFile",
21+
]
1122

1223

1324
class SessionCreateParams(TypedDict, total=False):
@@ -66,6 +77,20 @@ class Dimensions(TypedDict, total=False):
6677
"""Width of the session"""
6778

6879

80+
class SessionContextCookiePartitionKey(TypedDict, total=False):
81+
has_cross_site_ancestor: Required[Annotated[bool, PropertyInfo(alias="hasCrossSiteAncestor")]]
82+
"""
83+
Indicates if the cookie has any ancestors that are cross-site to the
84+
topLevelSite.
85+
"""
86+
87+
top_level_site: Required[Annotated[str, PropertyInfo(alias="topLevelSite")]]
88+
"""
89+
The site of the top-level URL the browser was visiting at the start of the
90+
request to the endpoint that set the cookie.
91+
"""
92+
93+
6994
class SessionContextCookie(TypedDict, total=False):
7095
name: Required[str]
7196
"""The name of the cookie"""
@@ -82,7 +107,7 @@ class SessionContextCookie(TypedDict, total=False):
82107
http_only: Annotated[bool, PropertyInfo(alias="httpOnly")]
83108
"""Whether the cookie is HTTP only"""
84109

85-
partition_key: Annotated[str, PropertyInfo(alias="partitionKey")]
110+
partition_key: Annotated[SessionContextCookiePartitionKey, PropertyInfo(alias="partitionKey")]
86111
"""The partition key of the cookie"""
87112

88113
path: str
@@ -116,15 +141,53 @@ class SessionContextCookie(TypedDict, total=False):
116141
"""The URL of the cookie"""
117142

118143

144+
class SessionContextIndexedDBDataRecordBlobFile(TypedDict, total=False):
145+
blob_number: Required[Annotated[float, PropertyInfo(alias="blobNumber")]]
146+
147+
mime_type: Required[Annotated[str, PropertyInfo(alias="mimeType")]]
148+
149+
size: Required[float]
150+
151+
filename: str
152+
153+
last_modified: Annotated[Union[str, datetime], PropertyInfo(alias="lastModified", format="iso8601")]
154+
155+
path: str
156+
157+
158+
class SessionContextIndexedDBDataRecord(TypedDict, total=False):
159+
blob_files: Annotated[Iterable[SessionContextIndexedDBDataRecordBlobFile], PropertyInfo(alias="blobFiles")]
160+
161+
key: object
162+
163+
value: object
164+
165+
166+
class SessionContextIndexedDBData(TypedDict, total=False):
167+
id: Required[float]
168+
169+
name: Required[str]
170+
171+
records: Required[Iterable[SessionContextIndexedDBDataRecord]]
172+
173+
174+
class SessionContextIndexedDB(TypedDict, total=False):
175+
id: Required[float]
176+
177+
data: Required[Iterable[SessionContextIndexedDBData]]
178+
179+
name: Required[str]
180+
181+
119182
class SessionContext(TypedDict, total=False):
120183
cookies: Iterable[SessionContextCookie]
121184
"""Cookies to initialize in the session"""
122185

123-
indexed_db: Annotated[Dict[str, Iterable[Dict[str, object]]], PropertyInfo(alias="indexedDB")]
186+
indexed_db: Annotated[Dict[str, Iterable[SessionContextIndexedDB]], PropertyInfo(alias="indexedDB")]
124187
"""Domain-specific indexedDB items to initialize in the session"""
125188

126-
local_storage: Annotated[Dict[str, Dict[str, object]], PropertyInfo(alias="localStorage")]
189+
local_storage: Annotated[Dict[str, Dict[str, str]], PropertyInfo(alias="localStorage")]
127190
"""Domain-specific localStorage items to initialize in the session"""
128191

129-
session_storage: Annotated[Dict[str, Dict[str, object]], PropertyInfo(alias="sessionStorage")]
192+
session_storage: Annotated[Dict[str, Dict[str, str]], PropertyInfo(alias="sessionStorage")]
130193
"""Domain-specific sessionStorage items to initialize in the session"""

tests/api_resources/test_sessions.py

Lines changed: 75 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
SessionLiveDetailsResponse,
1818
)
1919
from tests.utils import assert_matches_type
20+
from steel._utils import parse_datetime
2021
from steel.pagination import SyncSessionsCursor, AsyncSessionsCursor
2122
from steel.types.sessionslist import Session as SessionslistSession
2223

@@ -41,7 +42,7 @@ def test_method_create_with_all_params(self, client: Steel) -> None:
4142
"width": 0,
4243
},
4344
is_selenium=True,
44-
proxy_url="proxyUrl",
45+
proxy_url="https://example.com",
4546
session_context={
4647
"cookies": [
4748
{
@@ -50,7 +51,10 @@ def test_method_create_with_all_params(self, client: Steel) -> None:
5051
"domain": "domain",
5152
"expires": 0,
5253
"http_only": True,
53-
"partition_key": "partitionKey",
54+
"partition_key": {
55+
"has_cross_site_ancestor": True,
56+
"top_level_site": "topLevelSite",
57+
},
5458
"path": "path",
5559
"priority": "Low",
5660
"same_party": True,
@@ -63,9 +67,38 @@ def test_method_create_with_all_params(self, client: Steel) -> None:
6367
"url": "url",
6468
}
6569
],
66-
"indexed_db": {"foo": [{"foo": "bar"}]},
67-
"local_storage": {"foo": {"foo": "bar"}},
68-
"session_storage": {"foo": {"foo": "bar"}},
70+
"indexed_db": {
71+
"foo": [
72+
{
73+
"id": 0,
74+
"data": [
75+
{
76+
"id": 0,
77+
"name": "name",
78+
"records": [
79+
{
80+
"blob_files": [
81+
{
82+
"blob_number": 0,
83+
"mime_type": "mimeType",
84+
"size": 0,
85+
"filename": "filename",
86+
"last_modified": parse_datetime("2019-12-27T18:11:19.117Z"),
87+
"path": "path",
88+
}
89+
],
90+
"key": {},
91+
"value": {},
92+
}
93+
],
94+
}
95+
],
96+
"name": "name",
97+
}
98+
]
99+
},
100+
"local_storage": {"foo": {"foo": "string"}},
101+
"session_storage": {"foo": {"foo": "string"}},
69102
},
70103
session_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
71104
solve_captcha=True,
@@ -363,7 +396,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncSteel) ->
363396
"width": 0,
364397
},
365398
is_selenium=True,
366-
proxy_url="proxyUrl",
399+
proxy_url="https://example.com",
367400
session_context={
368401
"cookies": [
369402
{
@@ -372,7 +405,10 @@ async def test_method_create_with_all_params(self, async_client: AsyncSteel) ->
372405
"domain": "domain",
373406
"expires": 0,
374407
"http_only": True,
375-
"partition_key": "partitionKey",
408+
"partition_key": {
409+
"has_cross_site_ancestor": True,
410+
"top_level_site": "topLevelSite",
411+
},
376412
"path": "path",
377413
"priority": "Low",
378414
"same_party": True,
@@ -385,9 +421,38 @@ async def test_method_create_with_all_params(self, async_client: AsyncSteel) ->
385421
"url": "url",
386422
}
387423
],
388-
"indexed_db": {"foo": [{"foo": "bar"}]},
389-
"local_storage": {"foo": {"foo": "bar"}},
390-
"session_storage": {"foo": {"foo": "bar"}},
424+
"indexed_db": {
425+
"foo": [
426+
{
427+
"id": 0,
428+
"data": [
429+
{
430+
"id": 0,
431+
"name": "name",
432+
"records": [
433+
{
434+
"blob_files": [
435+
{
436+
"blob_number": 0,
437+
"mime_type": "mimeType",
438+
"size": 0,
439+
"filename": "filename",
440+
"last_modified": parse_datetime("2019-12-27T18:11:19.117Z"),
441+
"path": "path",
442+
}
443+
],
444+
"key": {},
445+
"value": {},
446+
}
447+
],
448+
}
449+
],
450+
"name": "name",
451+
}
452+
]
453+
},
454+
"local_storage": {"foo": {"foo": "string"}},
455+
"session_storage": {"foo": {"foo": "string"}},
391456
},
392457
session_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
393458
solve_captcha=True,

0 commit comments

Comments
 (0)