Skip to content

Commit a974019

Browse files
feat: Add stainless CI
1 parent d9f7664 commit a974019

File tree

15 files changed

+1547
-14
lines changed

15 files changed

+1547
-14
lines changed

.stats.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
configured_endpoints: 46
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/kernel%2Fkernel-cb38560915edce03abce2ae3ef5bc745489dbe9b6f80c2b4ff42edf8c2ff276d.yml
3-
openapi_spec_hash: a869194d6c864ba28d79ec0105439c3e
4-
config_hash: ed56f95781ec9b2e73c97e1a66606071
1+
configured_endpoints: 50
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/kernel%2Fkernel-d3a597bbbb25c131e2c06eb9b47d70932d14a97a6f916677a195a128e196f4db.yml
3+
openapi_spec_hash: c967b384624017eed0abff1b53a74530
4+
config_hash: 0d150b61cae2dc57d3648ceae7784966

api.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,3 +178,18 @@ Methods:
178178
- <code title="get /profiles">client.profiles.<a href="./src/kernel/resources/profiles.py">list</a>() -> <a href="./src/kernel/types/profile_list_response.py">ProfileListResponse</a></code>
179179
- <code title="delete /profiles/{id_or_name}">client.profiles.<a href="./src/kernel/resources/profiles.py">delete</a>(id_or_name) -> None</code>
180180
- <code title="get /profiles/{id_or_name}/download">client.profiles.<a href="./src/kernel/resources/profiles.py">download</a>(id_or_name) -> BinaryAPIResponse</code>
181+
182+
# Proxies
183+
184+
Types:
185+
186+
```python
187+
from kernel.types import ProxyCreateResponse, ProxyRetrieveResponse, ProxyListResponse
188+
```
189+
190+
Methods:
191+
192+
- <code title="post /proxies">client.proxies.<a href="./src/kernel/resources/proxies.py">create</a>(\*\*<a href="src/kernel/types/proxy_create_params.py">params</a>) -> <a href="./src/kernel/types/proxy_create_response.py">ProxyCreateResponse</a></code>
193+
- <code title="get /proxies/{id}">client.proxies.<a href="./src/kernel/resources/proxies.py">retrieve</a>(id) -> <a href="./src/kernel/types/proxy_retrieve_response.py">ProxyRetrieveResponse</a></code>
194+
- <code title="get /proxies">client.proxies.<a href="./src/kernel/resources/proxies.py">list</a>() -> <a href="./src/kernel/types/proxy_list_response.py">ProxyListResponse</a></code>
195+
- <code title="delete /proxies/{id}">client.proxies.<a href="./src/kernel/resources/proxies.py">delete</a>(id) -> None</code>

src/kernel/_client.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
)
2222
from ._utils import is_given, get_async_library
2323
from ._version import __version__
24-
from .resources import apps, profiles, deployments, invocations
24+
from .resources import apps, proxies, profiles, deployments, invocations
2525
from ._streaming import Stream as Stream, AsyncStream as AsyncStream
2626
from ._exceptions import KernelError, APIStatusError
2727
from ._base_client import (
@@ -55,6 +55,7 @@ class Kernel(SyncAPIClient):
5555
invocations: invocations.InvocationsResource
5656
browsers: browsers.BrowsersResource
5757
profiles: profiles.ProfilesResource
58+
proxies: proxies.ProxiesResource
5859
with_raw_response: KernelWithRawResponse
5960
with_streaming_response: KernelWithStreamedResponse
6061

@@ -141,6 +142,7 @@ def __init__(
141142
self.invocations = invocations.InvocationsResource(self)
142143
self.browsers = browsers.BrowsersResource(self)
143144
self.profiles = profiles.ProfilesResource(self)
145+
self.proxies = proxies.ProxiesResource(self)
144146
self.with_raw_response = KernelWithRawResponse(self)
145147
self.with_streaming_response = KernelWithStreamedResponse(self)
146148

@@ -257,6 +259,7 @@ class AsyncKernel(AsyncAPIClient):
257259
invocations: invocations.AsyncInvocationsResource
258260
browsers: browsers.AsyncBrowsersResource
259261
profiles: profiles.AsyncProfilesResource
262+
proxies: proxies.AsyncProxiesResource
260263
with_raw_response: AsyncKernelWithRawResponse
261264
with_streaming_response: AsyncKernelWithStreamedResponse
262265

@@ -343,6 +346,7 @@ def __init__(
343346
self.invocations = invocations.AsyncInvocationsResource(self)
344347
self.browsers = browsers.AsyncBrowsersResource(self)
345348
self.profiles = profiles.AsyncProfilesResource(self)
349+
self.proxies = proxies.AsyncProxiesResource(self)
346350
self.with_raw_response = AsyncKernelWithRawResponse(self)
347351
self.with_streaming_response = AsyncKernelWithStreamedResponse(self)
348352

@@ -460,6 +464,7 @@ def __init__(self, client: Kernel) -> None:
460464
self.invocations = invocations.InvocationsResourceWithRawResponse(client.invocations)
461465
self.browsers = browsers.BrowsersResourceWithRawResponse(client.browsers)
462466
self.profiles = profiles.ProfilesResourceWithRawResponse(client.profiles)
467+
self.proxies = proxies.ProxiesResourceWithRawResponse(client.proxies)
463468

464469

465470
class AsyncKernelWithRawResponse:
@@ -469,6 +474,7 @@ def __init__(self, client: AsyncKernel) -> None:
469474
self.invocations = invocations.AsyncInvocationsResourceWithRawResponse(client.invocations)
470475
self.browsers = browsers.AsyncBrowsersResourceWithRawResponse(client.browsers)
471476
self.profiles = profiles.AsyncProfilesResourceWithRawResponse(client.profiles)
477+
self.proxies = proxies.AsyncProxiesResourceWithRawResponse(client.proxies)
472478

473479

474480
class KernelWithStreamedResponse:
@@ -478,6 +484,7 @@ def __init__(self, client: Kernel) -> None:
478484
self.invocations = invocations.InvocationsResourceWithStreamingResponse(client.invocations)
479485
self.browsers = browsers.BrowsersResourceWithStreamingResponse(client.browsers)
480486
self.profiles = profiles.ProfilesResourceWithStreamingResponse(client.profiles)
487+
self.proxies = proxies.ProxiesResourceWithStreamingResponse(client.proxies)
481488

482489

483490
class AsyncKernelWithStreamedResponse:
@@ -487,6 +494,7 @@ def __init__(self, client: AsyncKernel) -> None:
487494
self.invocations = invocations.AsyncInvocationsResourceWithStreamingResponse(client.invocations)
488495
self.browsers = browsers.AsyncBrowsersResourceWithStreamingResponse(client.browsers)
489496
self.profiles = profiles.AsyncProfilesResourceWithStreamingResponse(client.profiles)
497+
self.proxies = proxies.AsyncProxiesResourceWithStreamingResponse(client.proxies)
490498

491499

492500
Client = Kernel

src/kernel/resources/__init__.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,14 @@
88
AppsResourceWithStreamingResponse,
99
AsyncAppsResourceWithStreamingResponse,
1010
)
11+
from .proxies import (
12+
ProxiesResource,
13+
AsyncProxiesResource,
14+
ProxiesResourceWithRawResponse,
15+
AsyncProxiesResourceWithRawResponse,
16+
ProxiesResourceWithStreamingResponse,
17+
AsyncProxiesResourceWithStreamingResponse,
18+
)
1119
from .browsers import (
1220
BrowsersResource,
1321
AsyncBrowsersResource,
@@ -72,4 +80,10 @@
7280
"AsyncProfilesResourceWithRawResponse",
7381
"ProfilesResourceWithStreamingResponse",
7482
"AsyncProfilesResourceWithStreamingResponse",
83+
"ProxiesResource",
84+
"AsyncProxiesResource",
85+
"ProxiesResourceWithRawResponse",
86+
"AsyncProxiesResourceWithRawResponse",
87+
"ProxiesResourceWithStreamingResponse",
88+
"AsyncProxiesResourceWithStreamingResponse",
7589
]

src/kernel/resources/browsers/browsers.py

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ def create(
9999
invocation_id: str | Omit = omit,
100100
persistence: BrowserPersistenceParam | Omit = omit,
101101
profile: browser_create_params.Profile | Omit = omit,
102+
proxy_id: str | Omit = omit,
102103
stealth: bool | Omit = omit,
103104
timeout_seconds: int | Omit = omit,
104105
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
@@ -123,12 +124,18 @@ def create(
123124
specified, the matching profile will be loaded into the browser session.
124125
Profiles must be created beforehand.
125126
127+
proxy_id: Optional proxy to associate to the browser session. Must reference a proxy
128+
belonging to the caller's org.
129+
126130
stealth: If true, launches the browser in stealth mode to reduce detection by anti-bot
127131
mechanisms.
128132
129133
timeout_seconds: The number of seconds of inactivity before the browser session is terminated.
130134
Only applicable to non-persistent browsers. Activity includes CDP connections
131-
and live view connections. Defaults to 60 seconds.
135+
and live view connections. Defaults to 60 seconds. Minimum allowed is 10
136+
seconds. Maximum allowed is 86400 (24 hours). We check for inactivity every 5
137+
seconds, so the actual timeout behavior you will see is +/- 5 seconds around the
138+
specified value.
132139
133140
extra_headers: Send extra headers
134141
@@ -146,6 +153,7 @@ def create(
146153
"invocation_id": invocation_id,
147154
"persistence": persistence,
148155
"profile": profile,
156+
"proxy_id": proxy_id,
149157
"stealth": stealth,
150158
"timeout_seconds": timeout_seconds,
151159
},
@@ -325,6 +333,7 @@ async def create(
325333
invocation_id: str | Omit = omit,
326334
persistence: BrowserPersistenceParam | Omit = omit,
327335
profile: browser_create_params.Profile | Omit = omit,
336+
proxy_id: str | Omit = omit,
328337
stealth: bool | Omit = omit,
329338
timeout_seconds: int | Omit = omit,
330339
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
@@ -349,12 +358,18 @@ async def create(
349358
specified, the matching profile will be loaded into the browser session.
350359
Profiles must be created beforehand.
351360
361+
proxy_id: Optional proxy to associate to the browser session. Must reference a proxy
362+
belonging to the caller's org.
363+
352364
stealth: If true, launches the browser in stealth mode to reduce detection by anti-bot
353365
mechanisms.
354366
355367
timeout_seconds: The number of seconds of inactivity before the browser session is terminated.
356368
Only applicable to non-persistent browsers. Activity includes CDP connections
357-
and live view connections. Defaults to 60 seconds.
369+
and live view connections. Defaults to 60 seconds. Minimum allowed is 10
370+
seconds. Maximum allowed is 86400 (24 hours). We check for inactivity every 5
371+
seconds, so the actual timeout behavior you will see is +/- 5 seconds around the
372+
specified value.
358373
359374
extra_headers: Send extra headers
360375
@@ -372,6 +387,7 @@ async def create(
372387
"invocation_id": invocation_id,
373388
"persistence": persistence,
374389
"profile": profile,
390+
"proxy_id": proxy_id,
375391
"stealth": stealth,
376392
"timeout_seconds": timeout_seconds,
377393
},

src/kernel/resources/invocations.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,10 @@ def update(
150150
extra_body: Body | None = None,
151151
timeout: float | httpx.Timeout | None | NotGiven = not_given,
152152
) -> InvocationUpdateResponse:
153-
"""
154-
Update an invocation's status or output.
153+
"""Update an invocation's status or output.
154+
155+
This can used to cancel an invocation
156+
by setting the status to "failed".
155157
156158
Args:
157159
status: New status for the invocation.
@@ -380,8 +382,10 @@ async def update(
380382
extra_body: Body | None = None,
381383
timeout: float | httpx.Timeout | None | NotGiven = not_given,
382384
) -> InvocationUpdateResponse:
383-
"""
384-
Update an invocation's status or output.
385+
"""Update an invocation's status or output.
386+
387+
This can used to cancel an invocation
388+
by setting the status to "failed".
385389
386390
Args:
387391
status: New status for the invocation.

0 commit comments

Comments
 (0)