anchorbrowser 0.3.13__py3-none-any.whl → 0.5.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.
@@ -1,288 +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 batch_session_create_params
10
- from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given
11
- from .._utils import maybe_transform, async_maybe_transform
12
- from .._compat import cached_property
13
- from .._resource import SyncAPIResource, AsyncAPIResource
14
- from .._response import (
15
- to_raw_response_wrapper,
16
- to_streamed_response_wrapper,
17
- async_to_raw_response_wrapper,
18
- async_to_streamed_response_wrapper,
19
- )
20
- from .._base_client import make_request_options
21
- from ..types.batch_session_create_response import BatchSessionCreateResponse
22
- from ..types.batch_session_retrieve_response import BatchSessionRetrieveResponse
23
-
24
- __all__ = ["BatchSessionsResource", "AsyncBatchSessionsResource"]
25
-
26
-
27
- class BatchSessionsResource(SyncAPIResource):
28
- @cached_property
29
- def with_raw_response(self) -> BatchSessionsResourceWithRawResponse:
30
- """
31
- This property can be used as a prefix for any HTTP method call to return
32
- the raw response object instead of the parsed content.
33
-
34
- For more information, see https://www.github.com/anchorbrowser/AnchorBrowser-SDK-Python#accessing-raw-response-data-eg-headers
35
- """
36
- return BatchSessionsResourceWithRawResponse(self)
37
-
38
- @cached_property
39
- def with_streaming_response(self) -> BatchSessionsResourceWithStreamingResponse:
40
- """
41
- An alternative to `.with_raw_response` that doesn't eagerly read the response body.
42
-
43
- For more information, see https://www.github.com/anchorbrowser/AnchorBrowser-SDK-Python#with_streaming_response
44
- """
45
- return BatchSessionsResourceWithStreamingResponse(self)
46
-
47
- def create(
48
- self,
49
- *,
50
- count: int,
51
- configuration: batch_session_create_params.Configuration | Omit = omit,
52
- metadata: Dict[str, object] | Omit = omit,
53
- # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
54
- # The extra values given here take precedence over values defined on the client or passed to this method.
55
- extra_headers: Headers | None = None,
56
- extra_query: Query | None = None,
57
- extra_body: Body | None = None,
58
- timeout: float | httpx.Timeout | None | NotGiven = not_given,
59
- ) -> BatchSessionCreateResponse:
60
- """Creates multiple browser sessions in a single batch operation.
61
-
62
- This endpoint
63
- allows you to create up to 5,000 browser sessions simultaneously with the same
64
- configuration.
65
-
66
- The batch will be processed asynchronously, and you can monitor progress using
67
- the batch status endpoint.
68
-
69
- Args:
70
- count: Number of sessions to create in the batch (1-1000)
71
-
72
- configuration: Configuration that applies to all sessions in the batch
73
-
74
- metadata: Optional batch-level metadata for identification and organization
75
-
76
- extra_headers: Send extra headers
77
-
78
- extra_query: Add additional query parameters to the request
79
-
80
- extra_body: Add additional JSON properties to the request
81
-
82
- timeout: Override the client-level default timeout for this request, in seconds
83
- """
84
- return self._post(
85
- "/v1/batch-sessions",
86
- body=maybe_transform(
87
- {
88
- "count": count,
89
- "configuration": configuration,
90
- "metadata": metadata,
91
- },
92
- batch_session_create_params.BatchSessionCreateParams,
93
- ),
94
- options=make_request_options(
95
- extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
96
- ),
97
- cast_to=BatchSessionCreateResponse,
98
- )
99
-
100
- def retrieve(
101
- self,
102
- batch_id: str,
103
- *,
104
- # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
105
- # The extra values given here take precedence over values defined on the client or passed to this method.
106
- extra_headers: Headers | None = None,
107
- extra_query: Query | None = None,
108
- extra_body: Body | None = None,
109
- timeout: float | httpx.Timeout | None | NotGiven = not_given,
110
- ) -> BatchSessionRetrieveResponse:
111
- """
112
- Retrieves detailed status information for a specific batch, including progress,
113
- individual session details, and any errors that occurred.
114
-
115
- Args:
116
- extra_headers: Send extra headers
117
-
118
- extra_query: Add additional query parameters to the request
119
-
120
- extra_body: Add additional JSON properties to the request
121
-
122
- timeout: Override the client-level default timeout for this request, in seconds
123
- """
124
- if not batch_id:
125
- raise ValueError(f"Expected a non-empty value for `batch_id` but received {batch_id!r}")
126
- return self._get(
127
- f"/v1/batch-sessions/{batch_id}",
128
- options=make_request_options(
129
- extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
130
- ),
131
- cast_to=BatchSessionRetrieveResponse,
132
- )
133
-
134
-
135
- class AsyncBatchSessionsResource(AsyncAPIResource):
136
- @cached_property
137
- def with_raw_response(self) -> AsyncBatchSessionsResourceWithRawResponse:
138
- """
139
- This property can be used as a prefix for any HTTP method call to return
140
- the raw response object instead of the parsed content.
141
-
142
- For more information, see https://www.github.com/anchorbrowser/AnchorBrowser-SDK-Python#accessing-raw-response-data-eg-headers
143
- """
144
- return AsyncBatchSessionsResourceWithRawResponse(self)
145
-
146
- @cached_property
147
- def with_streaming_response(self) -> AsyncBatchSessionsResourceWithStreamingResponse:
148
- """
149
- An alternative to `.with_raw_response` that doesn't eagerly read the response body.
150
-
151
- For more information, see https://www.github.com/anchorbrowser/AnchorBrowser-SDK-Python#with_streaming_response
152
- """
153
- return AsyncBatchSessionsResourceWithStreamingResponse(self)
154
-
155
- async def create(
156
- self,
157
- *,
158
- count: int,
159
- configuration: batch_session_create_params.Configuration | Omit = omit,
160
- metadata: Dict[str, object] | Omit = omit,
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
- ) -> BatchSessionCreateResponse:
168
- """Creates multiple browser sessions in a single batch operation.
169
-
170
- This endpoint
171
- allows you to create up to 5,000 browser sessions simultaneously with the same
172
- configuration.
173
-
174
- The batch will be processed asynchronously, and you can monitor progress using
175
- the batch status endpoint.
176
-
177
- Args:
178
- count: Number of sessions to create in the batch (1-1000)
179
-
180
- configuration: Configuration that applies to all sessions in the batch
181
-
182
- metadata: Optional batch-level metadata for identification and organization
183
-
184
- extra_headers: Send extra headers
185
-
186
- extra_query: Add additional query parameters to the request
187
-
188
- extra_body: Add additional JSON properties to the request
189
-
190
- timeout: Override the client-level default timeout for this request, in seconds
191
- """
192
- return await self._post(
193
- "/v1/batch-sessions",
194
- body=await async_maybe_transform(
195
- {
196
- "count": count,
197
- "configuration": configuration,
198
- "metadata": metadata,
199
- },
200
- batch_session_create_params.BatchSessionCreateParams,
201
- ),
202
- options=make_request_options(
203
- extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
204
- ),
205
- cast_to=BatchSessionCreateResponse,
206
- )
207
-
208
- async def retrieve(
209
- self,
210
- batch_id: str,
211
- *,
212
- # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
213
- # The extra values given here take precedence over values defined on the client or passed to this method.
214
- extra_headers: Headers | None = None,
215
- extra_query: Query | None = None,
216
- extra_body: Body | None = None,
217
- timeout: float | httpx.Timeout | None | NotGiven = not_given,
218
- ) -> BatchSessionRetrieveResponse:
219
- """
220
- Retrieves detailed status information for a specific batch, including progress,
221
- individual session details, and any errors that occurred.
222
-
223
- Args:
224
- extra_headers: Send extra headers
225
-
226
- extra_query: Add additional query parameters to the request
227
-
228
- extra_body: Add additional JSON properties to the request
229
-
230
- timeout: Override the client-level default timeout for this request, in seconds
231
- """
232
- if not batch_id:
233
- raise ValueError(f"Expected a non-empty value for `batch_id` but received {batch_id!r}")
234
- return await self._get(
235
- f"/v1/batch-sessions/{batch_id}",
236
- options=make_request_options(
237
- extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
238
- ),
239
- cast_to=BatchSessionRetrieveResponse,
240
- )
241
-
242
-
243
- class BatchSessionsResourceWithRawResponse:
244
- def __init__(self, batch_sessions: BatchSessionsResource) -> None:
245
- self._batch_sessions = batch_sessions
246
-
247
- self.create = to_raw_response_wrapper(
248
- batch_sessions.create,
249
- )
250
- self.retrieve = to_raw_response_wrapper(
251
- batch_sessions.retrieve,
252
- )
253
-
254
-
255
- class AsyncBatchSessionsResourceWithRawResponse:
256
- def __init__(self, batch_sessions: AsyncBatchSessionsResource) -> None:
257
- self._batch_sessions = batch_sessions
258
-
259
- self.create = async_to_raw_response_wrapper(
260
- batch_sessions.create,
261
- )
262
- self.retrieve = async_to_raw_response_wrapper(
263
- batch_sessions.retrieve,
264
- )
265
-
266
-
267
- class BatchSessionsResourceWithStreamingResponse:
268
- def __init__(self, batch_sessions: BatchSessionsResource) -> None:
269
- self._batch_sessions = batch_sessions
270
-
271
- self.create = to_streamed_response_wrapper(
272
- batch_sessions.create,
273
- )
274
- self.retrieve = to_streamed_response_wrapper(
275
- batch_sessions.retrieve,
276
- )
277
-
278
-
279
- class AsyncBatchSessionsResourceWithStreamingResponse:
280
- def __init__(self, batch_sessions: AsyncBatchSessionsResource) -> None:
281
- self._batch_sessions = batch_sessions
282
-
283
- self.create = async_to_streamed_response_wrapper(
284
- batch_sessions.create,
285
- )
286
- self.retrieve = async_to_streamed_response_wrapper(
287
- batch_sessions.retrieve,
288
- )