tzafon 0.1.4__py3-none-any.whl → 1.4.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of tzafon might be problematic. Click here for more details.
- tzafon/__init__.py +114 -2
- tzafon/_base_client.py +1995 -0
- tzafon/_client.py +403 -0
- tzafon/_compat.py +219 -0
- tzafon/_constants.py +14 -0
- tzafon/_exceptions.py +108 -0
- tzafon/_files.py +123 -0
- tzafon/_models.py +835 -0
- tzafon/_qs.py +150 -0
- tzafon/_resource.py +43 -0
- tzafon/_response.py +830 -0
- tzafon/_streaming.py +333 -0
- tzafon/_types.py +260 -0
- tzafon/_utils/__init__.py +64 -0
- tzafon/_utils/_compat.py +45 -0
- tzafon/_utils/_datetime_parse.py +136 -0
- tzafon/_utils/_logs.py +25 -0
- tzafon/_utils/_proxy.py +65 -0
- tzafon/_utils/_reflection.py +42 -0
- tzafon/_utils/_resources_proxy.py +24 -0
- tzafon/_utils/_streams.py +12 -0
- tzafon/_utils/_sync.py +86 -0
- tzafon/_utils/_transform.py +457 -0
- tzafon/_utils/_typing.py +156 -0
- tzafon/_utils/_utils.py +421 -0
- tzafon/_version.py +4 -0
- tzafon/batch_wrapper.py +102 -0
- tzafon/client_extensions.py +61 -0
- tzafon/py.typed +0 -0
- tzafon/resources/__init__.py +19 -0
- tzafon/resources/computers.py +822 -0
- tzafon/types/__init__.py +13 -0
- tzafon/types/action_result.py +17 -0
- tzafon/types/computer_create_params.py +30 -0
- tzafon/types/computer_execute_action_params.py +11 -0
- tzafon/types/computer_execute_batch_params.py +11 -0
- tzafon/types/computer_execute_batch_response.py +8 -0
- tzafon/types/computer_keep_alive_response.py +8 -0
- tzafon/types/computer_list_response.py +10 -0
- tzafon/types/computer_navigate_params.py +11 -0
- tzafon/types/computer_response.py +19 -0
- tzafon/wrapper.py +102 -0
- tzafon-1.4.0.dist-info/METADATA +429 -0
- tzafon-1.4.0.dist-info/RECORD +46 -0
- {tzafon-0.1.4.dist-info → tzafon-1.4.0.dist-info}/WHEEL +1 -1
- tzafon-1.4.0.dist-info/licenses/LICENSE +7 -0
- tzafon/_connection.py +0 -49
- tzafon/client.py +0 -116
- tzafon/exceptions.py +0 -6
- tzafon/models.py +0 -99
- tzafon-0.1.4.dist-info/METADATA +0 -62
- tzafon-0.1.4.dist-info/RECORD +0 -8
|
@@ -0,0 +1,822 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import httpx
|
|
6
|
+
|
|
7
|
+
from ..types import (
|
|
8
|
+
computer_create_params,
|
|
9
|
+
computer_navigate_params,
|
|
10
|
+
computer_execute_batch_params,
|
|
11
|
+
computer_execute_action_params,
|
|
12
|
+
)
|
|
13
|
+
from .._types import Body, Omit, Query, Headers, NoneType, NotGiven, omit, not_given
|
|
14
|
+
from .._utils import maybe_transform, async_maybe_transform
|
|
15
|
+
from .._compat import cached_property
|
|
16
|
+
from .._resource import SyncAPIResource, AsyncAPIResource
|
|
17
|
+
from .._response import (
|
|
18
|
+
to_raw_response_wrapper,
|
|
19
|
+
to_streamed_response_wrapper,
|
|
20
|
+
async_to_raw_response_wrapper,
|
|
21
|
+
async_to_streamed_response_wrapper,
|
|
22
|
+
)
|
|
23
|
+
from .._base_client import make_request_options
|
|
24
|
+
from ..types.action_result import ActionResult
|
|
25
|
+
from ..types.computer_response import ComputerResponse
|
|
26
|
+
from ..types.computer_list_response import ComputerListResponse
|
|
27
|
+
from ..types.computer_keep_alive_response import ComputerKeepAliveResponse
|
|
28
|
+
from ..types.computer_execute_batch_response import ComputerExecuteBatchResponse
|
|
29
|
+
|
|
30
|
+
__all__ = ["ComputersResource", "AsyncComputersResource"]
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
class ComputersResource(SyncAPIResource):
|
|
34
|
+
@cached_property
|
|
35
|
+
def with_raw_response(self) -> ComputersResourceWithRawResponse:
|
|
36
|
+
"""
|
|
37
|
+
This property can be used as a prefix for any HTTP method call to return
|
|
38
|
+
the raw response object instead of the parsed content.
|
|
39
|
+
|
|
40
|
+
For more information, see https://www.github.com/atulgavandetzafon/computer-python#accessing-raw-response-data-eg-headers
|
|
41
|
+
"""
|
|
42
|
+
return ComputersResourceWithRawResponse(self)
|
|
43
|
+
|
|
44
|
+
@cached_property
|
|
45
|
+
def with_streaming_response(self) -> ComputersResourceWithStreamingResponse:
|
|
46
|
+
"""
|
|
47
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
|
48
|
+
|
|
49
|
+
For more information, see https://www.github.com/atulgavandetzafon/computer-python#with_streaming_response
|
|
50
|
+
"""
|
|
51
|
+
return ComputersResourceWithStreamingResponse(self)
|
|
52
|
+
|
|
53
|
+
def create(
|
|
54
|
+
self,
|
|
55
|
+
*,
|
|
56
|
+
context_id: str | Omit = omit,
|
|
57
|
+
display: computer_create_params.Display | Omit = omit,
|
|
58
|
+
kind: str | Omit = omit,
|
|
59
|
+
stealth: object | Omit = omit,
|
|
60
|
+
timeout_seconds: int | Omit = omit,
|
|
61
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
62
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
63
|
+
extra_headers: Headers | None = None,
|
|
64
|
+
extra_query: Query | None = None,
|
|
65
|
+
extra_body: Body | None = None,
|
|
66
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
67
|
+
) -> ComputerResponse:
|
|
68
|
+
"""
|
|
69
|
+
Create a new browser or desktop automation session
|
|
70
|
+
|
|
71
|
+
Args:
|
|
72
|
+
display: TODO: implement
|
|
73
|
+
|
|
74
|
+
kind: "browser"|"desktop"|"code" etc
|
|
75
|
+
|
|
76
|
+
stealth: TODO: implement
|
|
77
|
+
|
|
78
|
+
extra_headers: Send extra headers
|
|
79
|
+
|
|
80
|
+
extra_query: Add additional query parameters to the request
|
|
81
|
+
|
|
82
|
+
extra_body: Add additional JSON properties to the request
|
|
83
|
+
|
|
84
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
85
|
+
"""
|
|
86
|
+
return self._post(
|
|
87
|
+
"/computers",
|
|
88
|
+
body=maybe_transform(
|
|
89
|
+
{
|
|
90
|
+
"context_id": context_id,
|
|
91
|
+
"display": display,
|
|
92
|
+
"kind": kind,
|
|
93
|
+
"stealth": stealth,
|
|
94
|
+
"timeout_seconds": timeout_seconds,
|
|
95
|
+
},
|
|
96
|
+
computer_create_params.ComputerCreateParams,
|
|
97
|
+
),
|
|
98
|
+
options=make_request_options(
|
|
99
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
100
|
+
),
|
|
101
|
+
cast_to=ComputerResponse,
|
|
102
|
+
)
|
|
103
|
+
|
|
104
|
+
def retrieve(
|
|
105
|
+
self,
|
|
106
|
+
id: str,
|
|
107
|
+
*,
|
|
108
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
109
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
110
|
+
extra_headers: Headers | None = None,
|
|
111
|
+
extra_query: Query | None = None,
|
|
112
|
+
extra_body: Body | None = None,
|
|
113
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
114
|
+
) -> ComputerResponse:
|
|
115
|
+
"""
|
|
116
|
+
Get the current status of a computer instance
|
|
117
|
+
|
|
118
|
+
Args:
|
|
119
|
+
extra_headers: Send extra headers
|
|
120
|
+
|
|
121
|
+
extra_query: Add additional query parameters to the request
|
|
122
|
+
|
|
123
|
+
extra_body: Add additional JSON properties to the request
|
|
124
|
+
|
|
125
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
126
|
+
"""
|
|
127
|
+
if not id:
|
|
128
|
+
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
|
|
129
|
+
return self._get(
|
|
130
|
+
f"/computers/{id}",
|
|
131
|
+
options=make_request_options(
|
|
132
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
133
|
+
),
|
|
134
|
+
cast_to=ComputerResponse,
|
|
135
|
+
)
|
|
136
|
+
|
|
137
|
+
def list(
|
|
138
|
+
self,
|
|
139
|
+
*,
|
|
140
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
141
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
142
|
+
extra_headers: Headers | None = None,
|
|
143
|
+
extra_query: Query | None = None,
|
|
144
|
+
extra_body: Body | None = None,
|
|
145
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
146
|
+
) -> ComputerListResponse:
|
|
147
|
+
"""List all active computers for the user's organization"""
|
|
148
|
+
return self._get(
|
|
149
|
+
"/computers",
|
|
150
|
+
options=make_request_options(
|
|
151
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
152
|
+
),
|
|
153
|
+
cast_to=ComputerListResponse,
|
|
154
|
+
)
|
|
155
|
+
|
|
156
|
+
def execute_action(
|
|
157
|
+
self,
|
|
158
|
+
id: str,
|
|
159
|
+
*,
|
|
160
|
+
body: object,
|
|
161
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
162
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
163
|
+
extra_headers: Headers | None = None,
|
|
164
|
+
extra_query: Query | None = None,
|
|
165
|
+
extra_body: Body | None = None,
|
|
166
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
167
|
+
) -> ActionResult:
|
|
168
|
+
"""
|
|
169
|
+
Execute a single action (screenshot, click, type, navigate, )
|
|
170
|
+
|
|
171
|
+
Args:
|
|
172
|
+
extra_headers: Send extra headers
|
|
173
|
+
|
|
174
|
+
extra_query: Add additional query parameters to the request
|
|
175
|
+
|
|
176
|
+
extra_body: Add additional JSON properties to the request
|
|
177
|
+
|
|
178
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
179
|
+
"""
|
|
180
|
+
if not id:
|
|
181
|
+
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
|
|
182
|
+
return self._post(
|
|
183
|
+
f"/computers/{id}/execute",
|
|
184
|
+
body=maybe_transform(body, computer_execute_action_params.ComputerExecuteActionParams),
|
|
185
|
+
options=make_request_options(
|
|
186
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
187
|
+
),
|
|
188
|
+
cast_to=ActionResult,
|
|
189
|
+
)
|
|
190
|
+
|
|
191
|
+
def execute_batch(
|
|
192
|
+
self,
|
|
193
|
+
id: str,
|
|
194
|
+
*,
|
|
195
|
+
body: object,
|
|
196
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
197
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
198
|
+
extra_headers: Headers | None = None,
|
|
199
|
+
extra_query: Query | None = None,
|
|
200
|
+
extra_body: Body | None = None,
|
|
201
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
202
|
+
) -> ComputerExecuteBatchResponse:
|
|
203
|
+
"""
|
|
204
|
+
Execute a batch of actions in sequence, stopping on first error
|
|
205
|
+
|
|
206
|
+
Args:
|
|
207
|
+
extra_headers: Send extra headers
|
|
208
|
+
|
|
209
|
+
extra_query: Add additional query parameters to the request
|
|
210
|
+
|
|
211
|
+
extra_body: Add additional JSON properties to the request
|
|
212
|
+
|
|
213
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
214
|
+
"""
|
|
215
|
+
if not id:
|
|
216
|
+
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
|
|
217
|
+
return self._post(
|
|
218
|
+
f"/computers/{id}/batch",
|
|
219
|
+
body=maybe_transform(body, computer_execute_batch_params.ComputerExecuteBatchParams),
|
|
220
|
+
options=make_request_options(
|
|
221
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
222
|
+
),
|
|
223
|
+
cast_to=ComputerExecuteBatchResponse,
|
|
224
|
+
)
|
|
225
|
+
|
|
226
|
+
def keep_alive(
|
|
227
|
+
self,
|
|
228
|
+
id: str,
|
|
229
|
+
*,
|
|
230
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
231
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
232
|
+
extra_headers: Headers | None = None,
|
|
233
|
+
extra_query: Query | None = None,
|
|
234
|
+
extra_body: Body | None = None,
|
|
235
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
236
|
+
) -> ComputerKeepAliveResponse:
|
|
237
|
+
"""
|
|
238
|
+
Extend the timeout for a computer session
|
|
239
|
+
|
|
240
|
+
Args:
|
|
241
|
+
extra_headers: Send extra headers
|
|
242
|
+
|
|
243
|
+
extra_query: Add additional query parameters to the request
|
|
244
|
+
|
|
245
|
+
extra_body: Add additional JSON properties to the request
|
|
246
|
+
|
|
247
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
248
|
+
"""
|
|
249
|
+
if not id:
|
|
250
|
+
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
|
|
251
|
+
return self._post(
|
|
252
|
+
f"/computers/{id}/keepalive",
|
|
253
|
+
options=make_request_options(
|
|
254
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
255
|
+
),
|
|
256
|
+
cast_to=ComputerKeepAliveResponse,
|
|
257
|
+
)
|
|
258
|
+
|
|
259
|
+
def navigate(
|
|
260
|
+
self,
|
|
261
|
+
id: str,
|
|
262
|
+
*,
|
|
263
|
+
body: object,
|
|
264
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
265
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
266
|
+
extra_headers: Headers | None = None,
|
|
267
|
+
extra_query: Query | None = None,
|
|
268
|
+
extra_body: Body | None = None,
|
|
269
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
270
|
+
) -> ActionResult:
|
|
271
|
+
"""
|
|
272
|
+
Navigate the browser to a specified URL
|
|
273
|
+
|
|
274
|
+
Args:
|
|
275
|
+
extra_headers: Send extra headers
|
|
276
|
+
|
|
277
|
+
extra_query: Add additional query parameters to the request
|
|
278
|
+
|
|
279
|
+
extra_body: Add additional JSON properties to the request
|
|
280
|
+
|
|
281
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
282
|
+
"""
|
|
283
|
+
if not id:
|
|
284
|
+
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
|
|
285
|
+
return self._post(
|
|
286
|
+
f"/computers/{id}/navigate",
|
|
287
|
+
body=maybe_transform(body, computer_navigate_params.ComputerNavigateParams),
|
|
288
|
+
options=make_request_options(
|
|
289
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
290
|
+
),
|
|
291
|
+
cast_to=ActionResult,
|
|
292
|
+
)
|
|
293
|
+
|
|
294
|
+
def stream_events(
|
|
295
|
+
self,
|
|
296
|
+
id: str,
|
|
297
|
+
*,
|
|
298
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
299
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
300
|
+
extra_headers: Headers | None = None,
|
|
301
|
+
extra_query: Query | None = None,
|
|
302
|
+
extra_body: Body | None = None,
|
|
303
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
304
|
+
) -> None:
|
|
305
|
+
"""
|
|
306
|
+
Stream real-time events using Server-Sent Events (SSE)
|
|
307
|
+
|
|
308
|
+
Args:
|
|
309
|
+
extra_headers: Send extra headers
|
|
310
|
+
|
|
311
|
+
extra_query: Add additional query parameters to the request
|
|
312
|
+
|
|
313
|
+
extra_body: Add additional JSON properties to the request
|
|
314
|
+
|
|
315
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
316
|
+
"""
|
|
317
|
+
if not id:
|
|
318
|
+
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
|
|
319
|
+
extra_headers = {"Accept": "*/*", **(extra_headers or {})}
|
|
320
|
+
return self._get(
|
|
321
|
+
f"/computers/{id}/events",
|
|
322
|
+
options=make_request_options(
|
|
323
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
324
|
+
),
|
|
325
|
+
cast_to=NoneType,
|
|
326
|
+
)
|
|
327
|
+
|
|
328
|
+
def terminate(
|
|
329
|
+
self,
|
|
330
|
+
id: str,
|
|
331
|
+
*,
|
|
332
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
333
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
334
|
+
extra_headers: Headers | None = None,
|
|
335
|
+
extra_query: Query | None = None,
|
|
336
|
+
extra_body: Body | None = None,
|
|
337
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
338
|
+
) -> None:
|
|
339
|
+
"""
|
|
340
|
+
Terminate and clean up a computer instance
|
|
341
|
+
|
|
342
|
+
Args:
|
|
343
|
+
extra_headers: Send extra headers
|
|
344
|
+
|
|
345
|
+
extra_query: Add additional query parameters to the request
|
|
346
|
+
|
|
347
|
+
extra_body: Add additional JSON properties to the request
|
|
348
|
+
|
|
349
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
350
|
+
"""
|
|
351
|
+
if not id:
|
|
352
|
+
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
|
|
353
|
+
extra_headers = {"Accept": "*/*", **(extra_headers or {})}
|
|
354
|
+
return self._delete(
|
|
355
|
+
f"/computers/{id}",
|
|
356
|
+
options=make_request_options(
|
|
357
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
358
|
+
),
|
|
359
|
+
cast_to=NoneType,
|
|
360
|
+
)
|
|
361
|
+
|
|
362
|
+
|
|
363
|
+
class AsyncComputersResource(AsyncAPIResource):
|
|
364
|
+
@cached_property
|
|
365
|
+
def with_raw_response(self) -> AsyncComputersResourceWithRawResponse:
|
|
366
|
+
"""
|
|
367
|
+
This property can be used as a prefix for any HTTP method call to return
|
|
368
|
+
the raw response object instead of the parsed content.
|
|
369
|
+
|
|
370
|
+
For more information, see https://www.github.com/atulgavandetzafon/computer-python#accessing-raw-response-data-eg-headers
|
|
371
|
+
"""
|
|
372
|
+
return AsyncComputersResourceWithRawResponse(self)
|
|
373
|
+
|
|
374
|
+
@cached_property
|
|
375
|
+
def with_streaming_response(self) -> AsyncComputersResourceWithStreamingResponse:
|
|
376
|
+
"""
|
|
377
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
|
378
|
+
|
|
379
|
+
For more information, see https://www.github.com/atulgavandetzafon/computer-python#with_streaming_response
|
|
380
|
+
"""
|
|
381
|
+
return AsyncComputersResourceWithStreamingResponse(self)
|
|
382
|
+
|
|
383
|
+
async def create(
|
|
384
|
+
self,
|
|
385
|
+
*,
|
|
386
|
+
context_id: str | Omit = omit,
|
|
387
|
+
display: computer_create_params.Display | Omit = omit,
|
|
388
|
+
kind: str | Omit = omit,
|
|
389
|
+
stealth: object | Omit = omit,
|
|
390
|
+
timeout_seconds: int | Omit = omit,
|
|
391
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
392
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
393
|
+
extra_headers: Headers | None = None,
|
|
394
|
+
extra_query: Query | None = None,
|
|
395
|
+
extra_body: Body | None = None,
|
|
396
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
397
|
+
) -> ComputerResponse:
|
|
398
|
+
"""
|
|
399
|
+
Create a new browser or desktop automation session
|
|
400
|
+
|
|
401
|
+
Args:
|
|
402
|
+
display: TODO: implement
|
|
403
|
+
|
|
404
|
+
kind: "browser"|"desktop"|"code" etc
|
|
405
|
+
|
|
406
|
+
stealth: TODO: implement
|
|
407
|
+
|
|
408
|
+
extra_headers: Send extra headers
|
|
409
|
+
|
|
410
|
+
extra_query: Add additional query parameters to the request
|
|
411
|
+
|
|
412
|
+
extra_body: Add additional JSON properties to the request
|
|
413
|
+
|
|
414
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
415
|
+
"""
|
|
416
|
+
return await self._post(
|
|
417
|
+
"/computers",
|
|
418
|
+
body=await async_maybe_transform(
|
|
419
|
+
{
|
|
420
|
+
"context_id": context_id,
|
|
421
|
+
"display": display,
|
|
422
|
+
"kind": kind,
|
|
423
|
+
"stealth": stealth,
|
|
424
|
+
"timeout_seconds": timeout_seconds,
|
|
425
|
+
},
|
|
426
|
+
computer_create_params.ComputerCreateParams,
|
|
427
|
+
),
|
|
428
|
+
options=make_request_options(
|
|
429
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
430
|
+
),
|
|
431
|
+
cast_to=ComputerResponse,
|
|
432
|
+
)
|
|
433
|
+
|
|
434
|
+
async def retrieve(
|
|
435
|
+
self,
|
|
436
|
+
id: str,
|
|
437
|
+
*,
|
|
438
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
439
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
440
|
+
extra_headers: Headers | None = None,
|
|
441
|
+
extra_query: Query | None = None,
|
|
442
|
+
extra_body: Body | None = None,
|
|
443
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
444
|
+
) -> ComputerResponse:
|
|
445
|
+
"""
|
|
446
|
+
Get the current status of a computer instance
|
|
447
|
+
|
|
448
|
+
Args:
|
|
449
|
+
extra_headers: Send extra headers
|
|
450
|
+
|
|
451
|
+
extra_query: Add additional query parameters to the request
|
|
452
|
+
|
|
453
|
+
extra_body: Add additional JSON properties to the request
|
|
454
|
+
|
|
455
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
456
|
+
"""
|
|
457
|
+
if not id:
|
|
458
|
+
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
|
|
459
|
+
return await self._get(
|
|
460
|
+
f"/computers/{id}",
|
|
461
|
+
options=make_request_options(
|
|
462
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
463
|
+
),
|
|
464
|
+
cast_to=ComputerResponse,
|
|
465
|
+
)
|
|
466
|
+
|
|
467
|
+
async def list(
|
|
468
|
+
self,
|
|
469
|
+
*,
|
|
470
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
471
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
472
|
+
extra_headers: Headers | None = None,
|
|
473
|
+
extra_query: Query | None = None,
|
|
474
|
+
extra_body: Body | None = None,
|
|
475
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
476
|
+
) -> ComputerListResponse:
|
|
477
|
+
"""List all active computers for the user's organization"""
|
|
478
|
+
return await self._get(
|
|
479
|
+
"/computers",
|
|
480
|
+
options=make_request_options(
|
|
481
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
482
|
+
),
|
|
483
|
+
cast_to=ComputerListResponse,
|
|
484
|
+
)
|
|
485
|
+
|
|
486
|
+
async def execute_action(
|
|
487
|
+
self,
|
|
488
|
+
id: str,
|
|
489
|
+
*,
|
|
490
|
+
body: object,
|
|
491
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
492
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
493
|
+
extra_headers: Headers | None = None,
|
|
494
|
+
extra_query: Query | None = None,
|
|
495
|
+
extra_body: Body | None = None,
|
|
496
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
497
|
+
) -> ActionResult:
|
|
498
|
+
"""
|
|
499
|
+
Execute a single action (screenshot, click, type, navigate, )
|
|
500
|
+
|
|
501
|
+
Args:
|
|
502
|
+
extra_headers: Send extra headers
|
|
503
|
+
|
|
504
|
+
extra_query: Add additional query parameters to the request
|
|
505
|
+
|
|
506
|
+
extra_body: Add additional JSON properties to the request
|
|
507
|
+
|
|
508
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
509
|
+
"""
|
|
510
|
+
if not id:
|
|
511
|
+
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
|
|
512
|
+
return await self._post(
|
|
513
|
+
f"/computers/{id}/execute",
|
|
514
|
+
body=await async_maybe_transform(body, computer_execute_action_params.ComputerExecuteActionParams),
|
|
515
|
+
options=make_request_options(
|
|
516
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
517
|
+
),
|
|
518
|
+
cast_to=ActionResult,
|
|
519
|
+
)
|
|
520
|
+
|
|
521
|
+
async def execute_batch(
|
|
522
|
+
self,
|
|
523
|
+
id: str,
|
|
524
|
+
*,
|
|
525
|
+
body: object,
|
|
526
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
527
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
528
|
+
extra_headers: Headers | None = None,
|
|
529
|
+
extra_query: Query | None = None,
|
|
530
|
+
extra_body: Body | None = None,
|
|
531
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
532
|
+
) -> ComputerExecuteBatchResponse:
|
|
533
|
+
"""
|
|
534
|
+
Execute a batch of actions in sequence, stopping on first error
|
|
535
|
+
|
|
536
|
+
Args:
|
|
537
|
+
extra_headers: Send extra headers
|
|
538
|
+
|
|
539
|
+
extra_query: Add additional query parameters to the request
|
|
540
|
+
|
|
541
|
+
extra_body: Add additional JSON properties to the request
|
|
542
|
+
|
|
543
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
544
|
+
"""
|
|
545
|
+
if not id:
|
|
546
|
+
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
|
|
547
|
+
return await self._post(
|
|
548
|
+
f"/computers/{id}/batch",
|
|
549
|
+
body=await async_maybe_transform(body, computer_execute_batch_params.ComputerExecuteBatchParams),
|
|
550
|
+
options=make_request_options(
|
|
551
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
552
|
+
),
|
|
553
|
+
cast_to=ComputerExecuteBatchResponse,
|
|
554
|
+
)
|
|
555
|
+
|
|
556
|
+
async def keep_alive(
|
|
557
|
+
self,
|
|
558
|
+
id: str,
|
|
559
|
+
*,
|
|
560
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
561
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
562
|
+
extra_headers: Headers | None = None,
|
|
563
|
+
extra_query: Query | None = None,
|
|
564
|
+
extra_body: Body | None = None,
|
|
565
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
566
|
+
) -> ComputerKeepAliveResponse:
|
|
567
|
+
"""
|
|
568
|
+
Extend the timeout for a computer session
|
|
569
|
+
|
|
570
|
+
Args:
|
|
571
|
+
extra_headers: Send extra headers
|
|
572
|
+
|
|
573
|
+
extra_query: Add additional query parameters to the request
|
|
574
|
+
|
|
575
|
+
extra_body: Add additional JSON properties to the request
|
|
576
|
+
|
|
577
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
578
|
+
"""
|
|
579
|
+
if not id:
|
|
580
|
+
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
|
|
581
|
+
return await self._post(
|
|
582
|
+
f"/computers/{id}/keepalive",
|
|
583
|
+
options=make_request_options(
|
|
584
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
585
|
+
),
|
|
586
|
+
cast_to=ComputerKeepAliveResponse,
|
|
587
|
+
)
|
|
588
|
+
|
|
589
|
+
async def navigate(
|
|
590
|
+
self,
|
|
591
|
+
id: str,
|
|
592
|
+
*,
|
|
593
|
+
body: object,
|
|
594
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
595
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
596
|
+
extra_headers: Headers | None = None,
|
|
597
|
+
extra_query: Query | None = None,
|
|
598
|
+
extra_body: Body | None = None,
|
|
599
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
600
|
+
) -> ActionResult:
|
|
601
|
+
"""
|
|
602
|
+
Navigate the browser to a specified URL
|
|
603
|
+
|
|
604
|
+
Args:
|
|
605
|
+
extra_headers: Send extra headers
|
|
606
|
+
|
|
607
|
+
extra_query: Add additional query parameters to the request
|
|
608
|
+
|
|
609
|
+
extra_body: Add additional JSON properties to the request
|
|
610
|
+
|
|
611
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
612
|
+
"""
|
|
613
|
+
if not id:
|
|
614
|
+
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
|
|
615
|
+
return await self._post(
|
|
616
|
+
f"/computers/{id}/navigate",
|
|
617
|
+
body=await async_maybe_transform(body, computer_navigate_params.ComputerNavigateParams),
|
|
618
|
+
options=make_request_options(
|
|
619
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
620
|
+
),
|
|
621
|
+
cast_to=ActionResult,
|
|
622
|
+
)
|
|
623
|
+
|
|
624
|
+
async def stream_events(
|
|
625
|
+
self,
|
|
626
|
+
id: str,
|
|
627
|
+
*,
|
|
628
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
629
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
630
|
+
extra_headers: Headers | None = None,
|
|
631
|
+
extra_query: Query | None = None,
|
|
632
|
+
extra_body: Body | None = None,
|
|
633
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
634
|
+
) -> None:
|
|
635
|
+
"""
|
|
636
|
+
Stream real-time events using Server-Sent Events (SSE)
|
|
637
|
+
|
|
638
|
+
Args:
|
|
639
|
+
extra_headers: Send extra headers
|
|
640
|
+
|
|
641
|
+
extra_query: Add additional query parameters to the request
|
|
642
|
+
|
|
643
|
+
extra_body: Add additional JSON properties to the request
|
|
644
|
+
|
|
645
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
646
|
+
"""
|
|
647
|
+
if not id:
|
|
648
|
+
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
|
|
649
|
+
extra_headers = {"Accept": "*/*", **(extra_headers or {})}
|
|
650
|
+
return await self._get(
|
|
651
|
+
f"/computers/{id}/events",
|
|
652
|
+
options=make_request_options(
|
|
653
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
654
|
+
),
|
|
655
|
+
cast_to=NoneType,
|
|
656
|
+
)
|
|
657
|
+
|
|
658
|
+
async def terminate(
|
|
659
|
+
self,
|
|
660
|
+
id: str,
|
|
661
|
+
*,
|
|
662
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
663
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
664
|
+
extra_headers: Headers | None = None,
|
|
665
|
+
extra_query: Query | None = None,
|
|
666
|
+
extra_body: Body | None = None,
|
|
667
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
668
|
+
) -> None:
|
|
669
|
+
"""
|
|
670
|
+
Terminate and clean up a computer instance
|
|
671
|
+
|
|
672
|
+
Args:
|
|
673
|
+
extra_headers: Send extra headers
|
|
674
|
+
|
|
675
|
+
extra_query: Add additional query parameters to the request
|
|
676
|
+
|
|
677
|
+
extra_body: Add additional JSON properties to the request
|
|
678
|
+
|
|
679
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
680
|
+
"""
|
|
681
|
+
if not id:
|
|
682
|
+
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
|
|
683
|
+
extra_headers = {"Accept": "*/*", **(extra_headers or {})}
|
|
684
|
+
return await self._delete(
|
|
685
|
+
f"/computers/{id}",
|
|
686
|
+
options=make_request_options(
|
|
687
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
688
|
+
),
|
|
689
|
+
cast_to=NoneType,
|
|
690
|
+
)
|
|
691
|
+
|
|
692
|
+
|
|
693
|
+
class ComputersResourceWithRawResponse:
|
|
694
|
+
def __init__(self, computers: ComputersResource) -> None:
|
|
695
|
+
self._computers = computers
|
|
696
|
+
|
|
697
|
+
self.create = to_raw_response_wrapper(
|
|
698
|
+
computers.create,
|
|
699
|
+
)
|
|
700
|
+
self.retrieve = to_raw_response_wrapper(
|
|
701
|
+
computers.retrieve,
|
|
702
|
+
)
|
|
703
|
+
self.list = to_raw_response_wrapper(
|
|
704
|
+
computers.list,
|
|
705
|
+
)
|
|
706
|
+
self.execute_action = to_raw_response_wrapper(
|
|
707
|
+
computers.execute_action,
|
|
708
|
+
)
|
|
709
|
+
self.execute_batch = to_raw_response_wrapper(
|
|
710
|
+
computers.execute_batch,
|
|
711
|
+
)
|
|
712
|
+
self.keep_alive = to_raw_response_wrapper(
|
|
713
|
+
computers.keep_alive,
|
|
714
|
+
)
|
|
715
|
+
self.navigate = to_raw_response_wrapper(
|
|
716
|
+
computers.navigate,
|
|
717
|
+
)
|
|
718
|
+
self.stream_events = to_raw_response_wrapper(
|
|
719
|
+
computers.stream_events,
|
|
720
|
+
)
|
|
721
|
+
self.terminate = to_raw_response_wrapper(
|
|
722
|
+
computers.terminate,
|
|
723
|
+
)
|
|
724
|
+
|
|
725
|
+
|
|
726
|
+
class AsyncComputersResourceWithRawResponse:
|
|
727
|
+
def __init__(self, computers: AsyncComputersResource) -> None:
|
|
728
|
+
self._computers = computers
|
|
729
|
+
|
|
730
|
+
self.create = async_to_raw_response_wrapper(
|
|
731
|
+
computers.create,
|
|
732
|
+
)
|
|
733
|
+
self.retrieve = async_to_raw_response_wrapper(
|
|
734
|
+
computers.retrieve,
|
|
735
|
+
)
|
|
736
|
+
self.list = async_to_raw_response_wrapper(
|
|
737
|
+
computers.list,
|
|
738
|
+
)
|
|
739
|
+
self.execute_action = async_to_raw_response_wrapper(
|
|
740
|
+
computers.execute_action,
|
|
741
|
+
)
|
|
742
|
+
self.execute_batch = async_to_raw_response_wrapper(
|
|
743
|
+
computers.execute_batch,
|
|
744
|
+
)
|
|
745
|
+
self.keep_alive = async_to_raw_response_wrapper(
|
|
746
|
+
computers.keep_alive,
|
|
747
|
+
)
|
|
748
|
+
self.navigate = async_to_raw_response_wrapper(
|
|
749
|
+
computers.navigate,
|
|
750
|
+
)
|
|
751
|
+
self.stream_events = async_to_raw_response_wrapper(
|
|
752
|
+
computers.stream_events,
|
|
753
|
+
)
|
|
754
|
+
self.terminate = async_to_raw_response_wrapper(
|
|
755
|
+
computers.terminate,
|
|
756
|
+
)
|
|
757
|
+
|
|
758
|
+
|
|
759
|
+
class ComputersResourceWithStreamingResponse:
|
|
760
|
+
def __init__(self, computers: ComputersResource) -> None:
|
|
761
|
+
self._computers = computers
|
|
762
|
+
|
|
763
|
+
self.create = to_streamed_response_wrapper(
|
|
764
|
+
computers.create,
|
|
765
|
+
)
|
|
766
|
+
self.retrieve = to_streamed_response_wrapper(
|
|
767
|
+
computers.retrieve,
|
|
768
|
+
)
|
|
769
|
+
self.list = to_streamed_response_wrapper(
|
|
770
|
+
computers.list,
|
|
771
|
+
)
|
|
772
|
+
self.execute_action = to_streamed_response_wrapper(
|
|
773
|
+
computers.execute_action,
|
|
774
|
+
)
|
|
775
|
+
self.execute_batch = to_streamed_response_wrapper(
|
|
776
|
+
computers.execute_batch,
|
|
777
|
+
)
|
|
778
|
+
self.keep_alive = to_streamed_response_wrapper(
|
|
779
|
+
computers.keep_alive,
|
|
780
|
+
)
|
|
781
|
+
self.navigate = to_streamed_response_wrapper(
|
|
782
|
+
computers.navigate,
|
|
783
|
+
)
|
|
784
|
+
self.stream_events = to_streamed_response_wrapper(
|
|
785
|
+
computers.stream_events,
|
|
786
|
+
)
|
|
787
|
+
self.terminate = to_streamed_response_wrapper(
|
|
788
|
+
computers.terminate,
|
|
789
|
+
)
|
|
790
|
+
|
|
791
|
+
|
|
792
|
+
class AsyncComputersResourceWithStreamingResponse:
|
|
793
|
+
def __init__(self, computers: AsyncComputersResource) -> None:
|
|
794
|
+
self._computers = computers
|
|
795
|
+
|
|
796
|
+
self.create = async_to_streamed_response_wrapper(
|
|
797
|
+
computers.create,
|
|
798
|
+
)
|
|
799
|
+
self.retrieve = async_to_streamed_response_wrapper(
|
|
800
|
+
computers.retrieve,
|
|
801
|
+
)
|
|
802
|
+
self.list = async_to_streamed_response_wrapper(
|
|
803
|
+
computers.list,
|
|
804
|
+
)
|
|
805
|
+
self.execute_action = async_to_streamed_response_wrapper(
|
|
806
|
+
computers.execute_action,
|
|
807
|
+
)
|
|
808
|
+
self.execute_batch = async_to_streamed_response_wrapper(
|
|
809
|
+
computers.execute_batch,
|
|
810
|
+
)
|
|
811
|
+
self.keep_alive = async_to_streamed_response_wrapper(
|
|
812
|
+
computers.keep_alive,
|
|
813
|
+
)
|
|
814
|
+
self.navigate = async_to_streamed_response_wrapper(
|
|
815
|
+
computers.navigate,
|
|
816
|
+
)
|
|
817
|
+
self.stream_events = async_to_streamed_response_wrapper(
|
|
818
|
+
computers.stream_events,
|
|
819
|
+
)
|
|
820
|
+
self.terminate = async_to_streamed_response_wrapper(
|
|
821
|
+
computers.terminate,
|
|
822
|
+
)
|