anchorbrowser 0.2.0__py3-none-any.whl → 0.3.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.
anchorbrowser/_client.py CHANGED
@@ -21,7 +21,7 @@ from ._types import (
21
21
  )
22
22
  from ._utils import is_given, get_async_library
23
23
  from ._version import __version__
24
- from .resources import agent, tools, events, browser, profiles, extensions, batch_sessions
24
+ from .resources import task, agent, tools, events, browser, profiles, extensions, batch_sessions
25
25
  from ._streaming import Stream as Stream, AsyncStream as AsyncStream
26
26
  from ._exceptions import APIStatusError, AnchorbrowserError
27
27
  from ._base_client import (
@@ -29,7 +29,6 @@ from ._base_client import (
29
29
  SyncAPIClient,
30
30
  AsyncAPIClient,
31
31
  )
32
- from .resources.task import task
33
32
  from .resources.sessions import sessions
34
33
 
35
34
  __all__ = [
anchorbrowser/_version.py CHANGED
@@ -1,4 +1,4 @@
1
1
  # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
3
  __title__ = "anchorbrowser"
4
- __version__ = "0.2.0" # x-release-please-version
4
+ __version__ = "0.3.0" # x-release-please-version
@@ -2,41 +2,32 @@
2
2
 
3
3
  from __future__ import annotations
4
4
 
5
+ from typing import Dict
5
6
  from typing_extensions import Literal
6
7
 
7
8
  import httpx
8
9
 
9
- from .run import (
10
- RunResource,
11
- AsyncRunResource,
12
- RunResourceWithRawResponse,
13
- AsyncRunResourceWithRawResponse,
14
- RunResourceWithStreamingResponse,
15
- AsyncRunResourceWithStreamingResponse,
16
- )
17
- from ...types import task_list_params, task_create_params
18
- from ..._types import Body, Omit, Query, Headers, NotGiven, omit, not_given
19
- from ..._utils import maybe_transform, async_maybe_transform
20
- from ..._compat import cached_property
21
- from ..._resource import SyncAPIResource, AsyncAPIResource
22
- from ..._response import (
10
+ from ..types import task_list_params, task_create_params
11
+ from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given
12
+ from .._utils import maybe_transform, async_maybe_transform
13
+ from .._compat import cached_property
14
+ from .._resource import SyncAPIResource, AsyncAPIResource
15
+ from .._response import (
23
16
  to_raw_response_wrapper,
24
17
  to_streamed_response_wrapper,
25
18
  async_to_raw_response_wrapper,
26
19
  async_to_streamed_response_wrapper,
27
20
  )
28
- from ..._base_client import make_request_options
29
- from ...types.task_list_response import TaskListResponse
30
- from ...types.task_create_response import TaskCreateResponse
21
+ from ..types.task import run_execute_params
22
+ from .._base_client import make_request_options
23
+ from ..types.task_list_response import TaskListResponse
24
+ from ..types.task_create_response import TaskCreateResponse
25
+ from ..types.task.run_execute_response import RunExecuteResponse
31
26
 
32
27
  __all__ = ["TaskResource", "AsyncTaskResource"]
33
28
 
34
29
 
35
30
  class TaskResource(SyncAPIResource):
36
- @cached_property
37
- def run(self) -> RunResource:
38
- return RunResource(self._client)
39
-
40
31
  @cached_property
41
32
  def with_raw_response(self) -> TaskResourceWithRawResponse:
42
33
  """
@@ -162,12 +153,70 @@ class TaskResource(SyncAPIResource):
162
153
  cast_to=TaskListResponse,
163
154
  )
164
155
 
156
+ def run(
157
+ self,
158
+ *,
159
+ task_id: str,
160
+ inputs: Dict[str, str] | Omit = omit,
161
+ override_browser_configuration: run_execute_params.OverrideBrowserConfiguration | Omit = omit,
162
+ session_id: str | Omit = omit,
163
+ task_session_id: str | Omit = omit,
164
+ version: str | Omit = omit,
165
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
166
+ # The extra values given here take precedence over values defined on the client or passed to this method.
167
+ extra_headers: Headers | None = None,
168
+ extra_query: Query | None = None,
169
+ extra_body: Body | None = None,
170
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
171
+ ) -> RunExecuteResponse:
172
+ """Executes a task in a browser session.
173
+
174
+ The task can be run with a specific
175
+ version or the latest version. Optionally, you can provide an existing session
176
+ ID or let the system create a new one.
165
177
 
166
- class AsyncTaskResource(AsyncAPIResource):
167
- @cached_property
168
- def run(self) -> AsyncRunResource:
169
- return AsyncRunResource(self._client)
178
+ Args:
179
+ task_id: Task identifier
180
+
181
+ inputs: Environment variables for task execution (keys must start with ANCHOR\\__)
182
+
183
+ override_browser_configuration: Override browser configuration for this execution
184
+
185
+ session_id: Optional existing session ID to use
186
+
187
+ task_session_id: Optional task-specific session ID
188
+
189
+ version: Version to run (draft, latest, or version number)
190
+
191
+ extra_headers: Send extra headers
170
192
 
193
+ extra_query: Add additional query parameters to the request
194
+
195
+ extra_body: Add additional JSON properties to the request
196
+
197
+ timeout: Override the client-level default timeout for this request, in seconds
198
+ """
199
+ return self._post(
200
+ "/v1/task/run",
201
+ body=maybe_transform(
202
+ {
203
+ "task_id": task_id,
204
+ "inputs": inputs,
205
+ "override_browser_configuration": override_browser_configuration,
206
+ "session_id": session_id,
207
+ "task_session_id": task_session_id,
208
+ "version": version,
209
+ },
210
+ run_execute_params.RunExecuteParams,
211
+ ),
212
+ options=make_request_options(
213
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
214
+ ),
215
+ cast_to=RunExecuteResponse,
216
+ )
217
+
218
+
219
+ class AsyncTaskResource(AsyncAPIResource):
171
220
  @cached_property
172
221
  def with_raw_response(self) -> AsyncTaskResourceWithRawResponse:
173
222
  """
@@ -293,6 +342,68 @@ class AsyncTaskResource(AsyncAPIResource):
293
342
  cast_to=TaskListResponse,
294
343
  )
295
344
 
345
+ async def run(
346
+ self,
347
+ *,
348
+ task_id: str,
349
+ inputs: Dict[str, str] | Omit = omit,
350
+ override_browser_configuration: run_execute_params.OverrideBrowserConfiguration | Omit = omit,
351
+ session_id: str | Omit = omit,
352
+ task_session_id: str | Omit = omit,
353
+ version: str | Omit = omit,
354
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
355
+ # The extra values given here take precedence over values defined on the client or passed to this method.
356
+ extra_headers: Headers | None = None,
357
+ extra_query: Query | None = None,
358
+ extra_body: Body | None = None,
359
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
360
+ ) -> RunExecuteResponse:
361
+ """Executes a task in a browser session.
362
+
363
+ The task can be run with a specific
364
+ version or the latest version. Optionally, you can provide an existing session
365
+ ID or let the system create a new one.
366
+
367
+ Args:
368
+ task_id: Task identifier
369
+
370
+ inputs: Environment variables for task execution (keys must start with ANCHOR\\__)
371
+
372
+ override_browser_configuration: Override browser configuration for this execution
373
+
374
+ session_id: Optional existing session ID to use
375
+
376
+ task_session_id: Optional task-specific session ID
377
+
378
+ version: Version to run (draft, latest, or version number)
379
+
380
+ extra_headers: Send extra headers
381
+
382
+ extra_query: Add additional query parameters to the request
383
+
384
+ extra_body: Add additional JSON properties to the request
385
+
386
+ timeout: Override the client-level default timeout for this request, in seconds
387
+ """
388
+ return await self._post(
389
+ "/v1/task/run",
390
+ body=await async_maybe_transform(
391
+ {
392
+ "task_id": task_id,
393
+ "inputs": inputs,
394
+ "override_browser_configuration": override_browser_configuration,
395
+ "session_id": session_id,
396
+ "task_session_id": task_session_id,
397
+ "version": version,
398
+ },
399
+ run_execute_params.RunExecuteParams,
400
+ ),
401
+ options=make_request_options(
402
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
403
+ ),
404
+ cast_to=RunExecuteResponse,
405
+ )
406
+
296
407
 
297
408
  class TaskResourceWithRawResponse:
298
409
  def __init__(self, task: TaskResource) -> None:
@@ -304,10 +415,9 @@ class TaskResourceWithRawResponse:
304
415
  self.list = to_raw_response_wrapper(
305
416
  task.list,
306
417
  )
307
-
308
- @cached_property
309
- def run(self) -> RunResourceWithRawResponse:
310
- return RunResourceWithRawResponse(self._task.run)
418
+ self.run = to_raw_response_wrapper(
419
+ task.run,
420
+ )
311
421
 
312
422
 
313
423
  class AsyncTaskResourceWithRawResponse:
@@ -320,10 +430,9 @@ class AsyncTaskResourceWithRawResponse:
320
430
  self.list = async_to_raw_response_wrapper(
321
431
  task.list,
322
432
  )
323
-
324
- @cached_property
325
- def run(self) -> AsyncRunResourceWithRawResponse:
326
- return AsyncRunResourceWithRawResponse(self._task.run)
433
+ self.run = async_to_raw_response_wrapper(
434
+ task.run,
435
+ )
327
436
 
328
437
 
329
438
  class TaskResourceWithStreamingResponse:
@@ -336,10 +445,9 @@ class TaskResourceWithStreamingResponse:
336
445
  self.list = to_streamed_response_wrapper(
337
446
  task.list,
338
447
  )
339
-
340
- @cached_property
341
- def run(self) -> RunResourceWithStreamingResponse:
342
- return RunResourceWithStreamingResponse(self._task.run)
448
+ self.run = to_streamed_response_wrapper(
449
+ task.run,
450
+ )
343
451
 
344
452
 
345
453
  class AsyncTaskResourceWithStreamingResponse:
@@ -352,7 +460,6 @@ class AsyncTaskResourceWithStreamingResponse:
352
460
  self.list = async_to_streamed_response_wrapper(
353
461
  task.list,
354
462
  )
355
-
356
- @cached_property
357
- def run(self) -> AsyncRunResourceWithStreamingResponse:
358
- return AsyncRunResourceWithStreamingResponse(self._task.run)
463
+ self.run = async_to_streamed_response_wrapper(
464
+ task.run,
465
+ )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: anchorbrowser
3
- Version: 0.2.0
3
+ Version: 0.3.0
4
4
  Summary: The official Python library for the anchorbrowser API
5
5
  Project-URL: Homepage, https://github.com/anchorbrowser/AnchorBrowser-SDK-Python
6
6
  Project-URL: Repository, https://github.com/anchorbrowser/AnchorBrowser-SDK-Python
@@ -1,6 +1,6 @@
1
1
  anchorbrowser/__init__.py,sha256=Wl16NhVAsaRBCpDtHZjZXDY31QMKfCIRNjzJcfb8D9E,2728
2
2
  anchorbrowser/_base_client.py,sha256=fl8ELiO1VjtUQLGCkJiTouZAxtX3b-teiU8Z0ANoR7g,67054
3
- anchorbrowser/_client.py,sha256=C9YvyT8axhgD2dxmz1Eby9YpbBO8fDhXqoosgH0_6TE,19613
3
+ anchorbrowser/_client.py,sha256=BXHIqml4Sz3u49HQvUxpvvTARWFwMhQBr3F9P5zVzv4,19586
4
4
  anchorbrowser/_compat.py,sha256=DQBVORjFb33zch24jzkhM14msvnzY7mmSmgDLaVFUM8,6562
5
5
  anchorbrowser/_constants.py,sha256=S14PFzyN9-I31wiV7SmIlL5Ga0MLHxdvegInGdXH7tM,462
6
6
  anchorbrowser/_exceptions.py,sha256=Qz7WOsYUFZ3bEoN28V-C9Wk-EvYerqP83-fMUINlZKQ,3234
@@ -11,7 +11,7 @@ anchorbrowser/_resource.py,sha256=7lE1EgpVj5kwckk-27umtigTOf9nKTyRl97cgNwRbRQ,11
11
11
  anchorbrowser/_response.py,sha256=xsiyWOC8LWW-NvbFtZ-MJD4f7eI9RnivKwtKImZ-8o4,28860
12
12
  anchorbrowser/_streaming.py,sha256=9uTovnqQkz3LRbIWe9fSWwzB_aI1cX14LvEuMhkEcDI,10128
13
13
  anchorbrowser/_types.py,sha256=hYSr4gk9908ZiGTqMX3pHhdzfzUUaHVelFS_I6p2Uj0,7243
14
- anchorbrowser/_version.py,sha256=D7UNO9-QmmM69sblWQWwuw6mCg8qXjJZ_SECRde7DNg,165
14
+ anchorbrowser/_version.py,sha256=AmvLvo2a7WWqbCB4Zco9XHoWL9wMNVir3L5m_V8pkr4,165
15
15
  anchorbrowser/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
16
16
  anchorbrowser/_utils/__init__.py,sha256=7fch0GT9zpNnErbciSpUNa-SjTxxjY6kxHxKMOM4AGs,2305
17
17
  anchorbrowser/_utils/_compat.py,sha256=D8gtAvjJQrDWt9upS0XaG9Rr5l1QhiAx_I_1utT_tt0,1195
@@ -35,6 +35,7 @@ anchorbrowser/resources/browser.py,sha256=BB5hq_ayIDL_ziYHq13oj8US3XkHzkoXiGLBm7
35
35
  anchorbrowser/resources/events.py,sha256=B6TwziBmOVMjWwoFO7OJR2X_Jt_3jtzNhQg4lgY-7SE,10780
36
36
  anchorbrowser/resources/extensions.py,sha256=KWySN-tu8Cxy-LbY3TXLNMPs1s5Hzwwk7Rmr1AYLVeU,15943
37
37
  anchorbrowser/resources/profiles.py,sha256=g6xLjfmdXfRM5QV-N-omShpSPO_jMvRRmxKjOllq5RQ,16206
38
+ anchorbrowser/resources/task.py,sha256=kqsbxtyTsO7yuOFlAJqq27uYQNqXtU5N793RIkTsEZ8,16974
38
39
  anchorbrowser/resources/tools.py,sha256=YWH5pWFHxedVAY6fIYJBkKGKPQmlMP0j3U40QC-Ip4o,23908
39
40
  anchorbrowser/resources/sessions/__init__.py,sha256=51tmuaKqEsEMfFTtZOovPAid6vYyKLkv6quuFBnQSiY,3330
40
41
  anchorbrowser/resources/sessions/all.py,sha256=5iN5Vv6UW-2p07lEqiRHw3fFQC4m_acfvsn3yZVi_g0,7193
@@ -48,9 +49,6 @@ anchorbrowser/resources/sessions/agent/files.py,sha256=E5pFDXEeaqJAN7DfE774WWJMf
48
49
  anchorbrowser/resources/sessions/recordings/__init__.py,sha256=MRWTb2Kwpc-wGBrcaa5YnTntQ9Z85Zd0McKS5K_mG00,1067
49
50
  anchorbrowser/resources/sessions/recordings/primary.py,sha256=p739aM0tU6CUx2KAgbo2O0oS-5T438Ho7SeUH9eSKXI,6569
50
51
  anchorbrowser/resources/sessions/recordings/recordings.py,sha256=LtaT51hX5GWdl21ypu2SGKzEHJHfsjWhJkqAy_fjWGo,13746
51
- anchorbrowser/resources/task/__init__.py,sha256=rSfpfA-FbxSo-sxvHcLrYoKxtoROVMy5ZIJmlDEZd00,937
52
- anchorbrowser/resources/task/run.py,sha256=WVKFUi5FJdtKNzI6M_YaHevz-5hbWoFEXEsjYzjMIbU,8293
53
- anchorbrowser/resources/task/task.py,sha256=vPNl0FAQAVrcHVKz1EzqZkvfX6PD10NOHm6xogW_XsM,12564
54
52
  anchorbrowser/types/__init__.py,sha256=mnuoFsN6OClbSkY0jpie8UQuq_ukz-XMlY6l_flVcHM,3620
55
53
  anchorbrowser/types/batch_session_create_params.py,sha256=ZmrNF7tOLvd7P4zFSNlz70HEC8wNJ51_VLGnC7h07nM,11530
56
54
  anchorbrowser/types/batch_session_create_response.py,sha256=K3EqFJzenfNDjzoTaWefPjuyULlxTMhdemBjKAd3_Dg,761
@@ -120,7 +118,7 @@ anchorbrowser/types/shared/success_response.py,sha256=l9OWrucXoSjBdsx5QKdvBPFtxv
120
118
  anchorbrowser/types/task/__init__.py,sha256=CbGxF7UFks1LsFq_wdSi62f4bgThKymv5OOSDmaFBI4,267
121
119
  anchorbrowser/types/task/run_execute_params.py,sha256=P-gRINLzKJ12Q03u7Pwu_6QJ8XFvyvAOVvguy03K98k,6680
122
120
  anchorbrowser/types/task/run_execute_response.py,sha256=ha86lTlKsLA_yZlaHNHEqBM1F--GiOLuifZpAk9J1bM,794
123
- anchorbrowser-0.2.0.dist-info/METADATA,sha256=Vjg83tRM0BK96P2PFyXXeoEQxP-3LS-DmdvNQWOFvTQ,15113
124
- anchorbrowser-0.2.0.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
125
- anchorbrowser-0.2.0.dist-info/licenses/LICENSE,sha256=QYTH6OztHxnELDn890vME8F7-euzmsHhWI4XOSYxwOg,11343
126
- anchorbrowser-0.2.0.dist-info/RECORD,,
121
+ anchorbrowser-0.3.0.dist-info/METADATA,sha256=acgevojvhk_8FafUlAZq9-cV9vmb92Bfr9l3tCP2nt4,15113
122
+ anchorbrowser-0.3.0.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
123
+ anchorbrowser-0.3.0.dist-info/licenses/LICENSE,sha256=QYTH6OztHxnELDn890vME8F7-euzmsHhWI4XOSYxwOg,11343
124
+ anchorbrowser-0.3.0.dist-info/RECORD,,
@@ -1,33 +0,0 @@
1
- # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
-
3
- from .run import (
4
- RunResource,
5
- AsyncRunResource,
6
- RunResourceWithRawResponse,
7
- AsyncRunResourceWithRawResponse,
8
- RunResourceWithStreamingResponse,
9
- AsyncRunResourceWithStreamingResponse,
10
- )
11
- from .task import (
12
- TaskResource,
13
- AsyncTaskResource,
14
- TaskResourceWithRawResponse,
15
- AsyncTaskResourceWithRawResponse,
16
- TaskResourceWithStreamingResponse,
17
- AsyncTaskResourceWithStreamingResponse,
18
- )
19
-
20
- __all__ = [
21
- "RunResource",
22
- "AsyncRunResource",
23
- "RunResourceWithRawResponse",
24
- "AsyncRunResourceWithRawResponse",
25
- "RunResourceWithStreamingResponse",
26
- "AsyncRunResourceWithStreamingResponse",
27
- "TaskResource",
28
- "AsyncTaskResource",
29
- "TaskResourceWithRawResponse",
30
- "AsyncTaskResourceWithRawResponse",
31
- "TaskResourceWithStreamingResponse",
32
- "AsyncTaskResourceWithStreamingResponse",
33
- ]
@@ -1,225 +0,0 @@
1
- # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
-
3
- from __future__ import annotations
4
-
5
- from typing import Dict
6
-
7
- import httpx
8
-
9
- from ..._types import Body, Omit, Query, Headers, NotGiven, omit, not_given
10
- from ..._utils import maybe_transform, async_maybe_transform
11
- from ..._compat import cached_property
12
- from ..._resource import SyncAPIResource, AsyncAPIResource
13
- from ..._response import (
14
- to_raw_response_wrapper,
15
- to_streamed_response_wrapper,
16
- async_to_raw_response_wrapper,
17
- async_to_streamed_response_wrapper,
18
- )
19
- from ...types.task import run_execute_params
20
- from ..._base_client import make_request_options
21
- from ...types.task.run_execute_response import RunExecuteResponse
22
-
23
- __all__ = ["RunResource", "AsyncRunResource"]
24
-
25
-
26
- class RunResource(SyncAPIResource):
27
- @cached_property
28
- def with_raw_response(self) -> RunResourceWithRawResponse:
29
- """
30
- This property can be used as a prefix for any HTTP method call to return
31
- the raw response object instead of the parsed content.
32
-
33
- For more information, see https://www.github.com/anchorbrowser/AnchorBrowser-SDK-Python#accessing-raw-response-data-eg-headers
34
- """
35
- return RunResourceWithRawResponse(self)
36
-
37
- @cached_property
38
- def with_streaming_response(self) -> RunResourceWithStreamingResponse:
39
- """
40
- An alternative to `.with_raw_response` that doesn't eagerly read the response body.
41
-
42
- For more information, see https://www.github.com/anchorbrowser/AnchorBrowser-SDK-Python#with_streaming_response
43
- """
44
- return RunResourceWithStreamingResponse(self)
45
-
46
- def execute(
47
- self,
48
- *,
49
- task_id: str,
50
- inputs: Dict[str, str] | Omit = omit,
51
- override_browser_configuration: run_execute_params.OverrideBrowserConfiguration | Omit = omit,
52
- session_id: str | Omit = omit,
53
- task_session_id: str | Omit = omit,
54
- version: str | Omit = omit,
55
- # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
56
- # The extra values given here take precedence over values defined on the client or passed to this method.
57
- extra_headers: Headers | None = None,
58
- extra_query: Query | None = None,
59
- extra_body: Body | None = None,
60
- timeout: float | httpx.Timeout | None | NotGiven = not_given,
61
- ) -> RunExecuteResponse:
62
- """Executes a task in a browser session.
63
-
64
- The task can be run with a specific
65
- version or the latest version. Optionally, you can provide an existing session
66
- ID or let the system create a new one.
67
-
68
- Args:
69
- task_id: Task identifier
70
-
71
- inputs: Environment variables for task execution (keys must start with ANCHOR\\__)
72
-
73
- override_browser_configuration: Override browser configuration for this execution
74
-
75
- session_id: Optional existing session ID to use
76
-
77
- task_session_id: Optional task-specific session ID
78
-
79
- version: Version to run (draft, latest, or version number)
80
-
81
- extra_headers: Send extra headers
82
-
83
- extra_query: Add additional query parameters to the request
84
-
85
- extra_body: Add additional JSON properties to the request
86
-
87
- timeout: Override the client-level default timeout for this request, in seconds
88
- """
89
- return self._post(
90
- "/v1/task/run",
91
- body=maybe_transform(
92
- {
93
- "task_id": task_id,
94
- "inputs": inputs,
95
- "override_browser_configuration": override_browser_configuration,
96
- "session_id": session_id,
97
- "task_session_id": task_session_id,
98
- "version": version,
99
- },
100
- run_execute_params.RunExecuteParams,
101
- ),
102
- options=make_request_options(
103
- extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
104
- ),
105
- cast_to=RunExecuteResponse,
106
- )
107
-
108
-
109
- class AsyncRunResource(AsyncAPIResource):
110
- @cached_property
111
- def with_raw_response(self) -> AsyncRunResourceWithRawResponse:
112
- """
113
- This property can be used as a prefix for any HTTP method call to return
114
- the raw response object instead of the parsed content.
115
-
116
- For more information, see https://www.github.com/anchorbrowser/AnchorBrowser-SDK-Python#accessing-raw-response-data-eg-headers
117
- """
118
- return AsyncRunResourceWithRawResponse(self)
119
-
120
- @cached_property
121
- def with_streaming_response(self) -> AsyncRunResourceWithStreamingResponse:
122
- """
123
- An alternative to `.with_raw_response` that doesn't eagerly read the response body.
124
-
125
- For more information, see https://www.github.com/anchorbrowser/AnchorBrowser-SDK-Python#with_streaming_response
126
- """
127
- return AsyncRunResourceWithStreamingResponse(self)
128
-
129
- async def execute(
130
- self,
131
- *,
132
- task_id: str,
133
- inputs: Dict[str, str] | Omit = omit,
134
- override_browser_configuration: run_execute_params.OverrideBrowserConfiguration | Omit = omit,
135
- session_id: str | Omit = omit,
136
- task_session_id: str | Omit = omit,
137
- version: str | Omit = omit,
138
- # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
139
- # The extra values given here take precedence over values defined on the client or passed to this method.
140
- extra_headers: Headers | None = None,
141
- extra_query: Query | None = None,
142
- extra_body: Body | None = None,
143
- timeout: float | httpx.Timeout | None | NotGiven = not_given,
144
- ) -> RunExecuteResponse:
145
- """Executes a task in a browser session.
146
-
147
- The task can be run with a specific
148
- version or the latest version. Optionally, you can provide an existing session
149
- ID or let the system create a new one.
150
-
151
- Args:
152
- task_id: Task identifier
153
-
154
- inputs: Environment variables for task execution (keys must start with ANCHOR\\__)
155
-
156
- override_browser_configuration: Override browser configuration for this execution
157
-
158
- session_id: Optional existing session ID to use
159
-
160
- task_session_id: Optional task-specific session ID
161
-
162
- version: Version to run (draft, latest, or version number)
163
-
164
- extra_headers: Send extra headers
165
-
166
- extra_query: Add additional query parameters to the request
167
-
168
- extra_body: Add additional JSON properties to the request
169
-
170
- timeout: Override the client-level default timeout for this request, in seconds
171
- """
172
- return await self._post(
173
- "/v1/task/run",
174
- body=await async_maybe_transform(
175
- {
176
- "task_id": task_id,
177
- "inputs": inputs,
178
- "override_browser_configuration": override_browser_configuration,
179
- "session_id": session_id,
180
- "task_session_id": task_session_id,
181
- "version": version,
182
- },
183
- run_execute_params.RunExecuteParams,
184
- ),
185
- options=make_request_options(
186
- extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
187
- ),
188
- cast_to=RunExecuteResponse,
189
- )
190
-
191
-
192
- class RunResourceWithRawResponse:
193
- def __init__(self, run: RunResource) -> None:
194
- self._run = run
195
-
196
- self.execute = to_raw_response_wrapper(
197
- run.execute,
198
- )
199
-
200
-
201
- class AsyncRunResourceWithRawResponse:
202
- def __init__(self, run: AsyncRunResource) -> None:
203
- self._run = run
204
-
205
- self.execute = async_to_raw_response_wrapper(
206
- run.execute,
207
- )
208
-
209
-
210
- class RunResourceWithStreamingResponse:
211
- def __init__(self, run: RunResource) -> None:
212
- self._run = run
213
-
214
- self.execute = to_streamed_response_wrapper(
215
- run.execute,
216
- )
217
-
218
-
219
- class AsyncRunResourceWithStreamingResponse:
220
- def __init__(self, run: AsyncRunResource) -> None:
221
- self._run = run
222
-
223
- self.execute = async_to_streamed_response_wrapper(
224
- run.execute,
225
- )