Skip to content

Commit e87dc0f

Browse files
feat(api): update via SDK Studio
1 parent e4b0438 commit e87dc0f

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
@@ -721,7 +721,13 @@ def test_retrying_timeout_errors_doesnt_leak(self, respx_mock: MockRouter) -> No
721721
with pytest.raises(APITimeoutError):
722722
self.client.post(
723723
"/browsers",
724-
body=cast(object, maybe_transform(dict(invocation_id="REPLACE_ME"), BrowserCreateParams)),
724+
body=cast(
725+
object,
726+
maybe_transform(
727+
dict(invocation_id="REPLACE_ME", persistence={"id": "browser-for-user-1234"}),
728+
BrowserCreateParams,
729+
),
730+
),
725731
cast_to=httpx.Response,
726732
options={"headers": {RAW_RESPONSE_HEADER: "stream"}},
727733
)
@@ -737,7 +743,13 @@ def test_retrying_status_errors_doesnt_leak(self, respx_mock: MockRouter) -> Non
737743
with pytest.raises(APIStatusError):
738744
self.client.post(
739745
"/browsers",
740-
body=cast(object, maybe_transform(dict(invocation_id="REPLACE_ME"), BrowserCreateParams)),
746+
body=cast(
747+
object,
748+
maybe_transform(
749+
dict(invocation_id="REPLACE_ME", persistence={"id": "browser-for-user-1234"}),
750+
BrowserCreateParams,
751+
),
752+
),
741753
cast_to=httpx.Response,
742754
options={"headers": {RAW_RESPONSE_HEADER: "stream"}},
743755
)
@@ -1513,7 +1525,13 @@ async def test_retrying_timeout_errors_doesnt_leak(self, respx_mock: MockRouter)
15131525
with pytest.raises(APITimeoutError):
15141526
await self.client.post(
15151527
"/browsers",
1516-
body=cast(object, maybe_transform(dict(invocation_id="REPLACE_ME"), BrowserCreateParams)),
1528+
body=cast(
1529+
object,
1530+
maybe_transform(
1531+
dict(invocation_id="REPLACE_ME", persistence={"id": "browser-for-user-1234"}),
1532+
BrowserCreateParams,
1533+
),
1534+
),
15171535
cast_to=httpx.Response,
15181536
options={"headers": {RAW_RESPONSE_HEADER: "stream"}},
15191537
)
@@ -1529,7 +1547,13 @@ async def test_retrying_status_errors_doesnt_leak(self, respx_mock: MockRouter)
15291547
with pytest.raises(APIStatusError):
15301548
await self.client.post(
15311549
"/browsers",
1532-
body=cast(object, maybe_transform(dict(invocation_id="REPLACE_ME"), BrowserCreateParams)),
1550+
body=cast(
1551+
object,
1552+
maybe_transform(
1553+
dict(invocation_id="REPLACE_ME", persistence={"id": "browser-for-user-1234"}),
1554+
BrowserCreateParams,
1555+
),
1556+
),
15331557
cast_to=httpx.Response,
15341558
options={"headers": {RAW_RESPONSE_HEADER: "stream"}},
15351559
)

0 commit comments

Comments
 (0)