Skip to content

Commit 43f0dbb

Browse files
feat(api): update via SDK Studio
1 parent f7da56f commit 43f0dbb

File tree

3 files changed

+36
-5
lines changed

3 files changed

+36
-5
lines changed

.stats.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 10
22
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/kernel%2Fkernel-3edc7a0eef4a0d4495782efbdb0d9b777a55aee058dab119f90de56019441326.yml
33
openapi_spec_hash: dff0b1efa1c1614cf770ed8327cefab2
4-
config_hash: f33cc77a9c01e879ad127194c897a988
4+
config_hash: cb04a4d88ee9f530b303ca57ff7090b3

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ client = Kernel()
139139
try:
140140
client.browsers.create(
141141
invocation_id="REPLACE_ME",
142+
persistence={"id": "browser-for-user-1234"},
142143
)
143144
except kernel.APIConnectionError as e:
144145
print("The server could not be reached")
@@ -184,6 +185,7 @@ client = Kernel(
184185
# Or, configure per-request:
185186
client.with_options(max_retries=5).browsers.create(
186187
invocation_id="REPLACE_ME",
188+
persistence={"id": "browser-for-user-1234"},
187189
)
188190
```
189191

@@ -209,6 +211,7 @@ client = Kernel(
209211
# Override per-request:
210212
client.with_options(timeout=5.0).browsers.create(
211213
invocation_id="REPLACE_ME",
214+
persistence={"id": "browser-for-user-1234"},
212215
)
213216
```
214217

@@ -252,6 +255,9 @@ from kernel import Kernel
252255
client = Kernel()
253256
response = client.browsers.with_raw_response.create(
254257
invocation_id="REPLACE_ME",
258+
persistence={
259+
"id": "browser-for-user-1234"
260+
},
255261
)
256262
print(response.headers.get('X-My-Header'))
257263

@@ -272,6 +278,7 @@ To stream the response body, use `.with_streaming_response` instead, which requi
272278
```python
273279
with client.browsers.with_streaming_response.create(
274280
invocation_id="REPLACE_ME",
281+
persistence={"id": "browser-for-user-1234"},
275282
) as response:
276283
print(response.headers.get("X-My-Header"))
277284

tests/test_client.py

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -720,7 +720,13 @@ def test_retrying_timeout_errors_doesnt_leak(self, respx_mock: MockRouter) -> No
720720
with pytest.raises(APITimeoutError):
721721
self.client.post(
722722
"/browsers",
723-
body=cast(object, maybe_transform(dict(invocation_id="REPLACE_ME"), BrowserCreateParams)),
723+
body=cast(
724+
object,
725+
maybe_transform(
726+
dict(invocation_id="REPLACE_ME", persistence={"id": "browser-for-user-1234"}),
727+
BrowserCreateParams,
728+
),
729+
),
724730
cast_to=httpx.Response,
725731
options={"headers": {RAW_RESPONSE_HEADER: "stream"}},
726732
)
@@ -735,7 +741,13 @@ def test_retrying_status_errors_doesnt_leak(self, respx_mock: MockRouter) -> Non
735741
with pytest.raises(APIStatusError):
736742
self.client.post(
737743
"/browsers",
738-
body=cast(object, maybe_transform(dict(invocation_id="REPLACE_ME"), BrowserCreateParams)),
744+
body=cast(
745+
object,
746+
maybe_transform(
747+
dict(invocation_id="REPLACE_ME", persistence={"id": "browser-for-user-1234"}),
748+
BrowserCreateParams,
749+
),
750+
),
739751
cast_to=httpx.Response,
740752
options={"headers": {RAW_RESPONSE_HEADER: "stream"}},
741753
)
@@ -1510,7 +1522,13 @@ async def test_retrying_timeout_errors_doesnt_leak(self, respx_mock: MockRouter)
15101522
with pytest.raises(APITimeoutError):
15111523
await self.client.post(
15121524
"/browsers",
1513-
body=cast(object, maybe_transform(dict(invocation_id="REPLACE_ME"), BrowserCreateParams)),
1525+
body=cast(
1526+
object,
1527+
maybe_transform(
1528+
dict(invocation_id="REPLACE_ME", persistence={"id": "browser-for-user-1234"}),
1529+
BrowserCreateParams,
1530+
),
1531+
),
15141532
cast_to=httpx.Response,
15151533
options={"headers": {RAW_RESPONSE_HEADER: "stream"}},
15161534
)
@@ -1525,7 +1543,13 @@ async def test_retrying_status_errors_doesnt_leak(self, respx_mock: MockRouter)
15251543
with pytest.raises(APIStatusError):
15261544
await self.client.post(
15271545
"/browsers",
1528-
body=cast(object, maybe_transform(dict(invocation_id="REPLACE_ME"), BrowserCreateParams)),
1546+
body=cast(
1547+
object,
1548+
maybe_transform(
1549+
dict(invocation_id="REPLACE_ME", persistence={"id": "browser-for-user-1234"}),
1550+
BrowserCreateParams,
1551+
),
1552+
),
15291553
cast_to=httpx.Response,
15301554
options={"headers": {RAW_RESPONSE_HEADER: "stream"}},
15311555
)

0 commit comments

Comments
 (0)