anchorbrowser 0.1.0a3__py3-none-any.whl → 0.2.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/__init__.py +3 -1
- anchorbrowser/_base_client.py +16 -13
- anchorbrowser/_client.py +38 -9
- anchorbrowser/_compat.py +48 -48
- anchorbrowser/_files.py +4 -4
- anchorbrowser/_models.py +54 -45
- anchorbrowser/_qs.py +7 -7
- anchorbrowser/_types.py +53 -12
- anchorbrowser/_utils/__init__.py +9 -2
- anchorbrowser/_utils/_compat.py +45 -0
- anchorbrowser/_utils/_datetime_parse.py +136 -0
- anchorbrowser/_utils/_transform.py +13 -3
- anchorbrowser/_utils/_typing.py +6 -1
- anchorbrowser/_utils/_utils.py +4 -5
- anchorbrowser/_version.py +1 -1
- anchorbrowser/lib/browser.py +1 -1
- anchorbrowser/resources/__init__.py +42 -0
- anchorbrowser/resources/batch_sessions.py +288 -0
- anchorbrowser/resources/events.py +270 -0
- anchorbrowser/resources/extensions.py +9 -9
- anchorbrowser/resources/profiles.py +24 -150
- anchorbrowser/resources/sessions/__init__.py +14 -0
- anchorbrowser/resources/sessions/agent/__init__.py +33 -0
- anchorbrowser/resources/sessions/agent/agent.py +273 -0
- anchorbrowser/resources/sessions/agent/files.py +280 -0
- anchorbrowser/resources/sessions/all.py +5 -5
- anchorbrowser/resources/sessions/clipboard.py +5 -5
- anchorbrowser/resources/sessions/keyboard.py +11 -13
- anchorbrowser/resources/sessions/mouse.py +12 -244
- anchorbrowser/resources/sessions/recordings/primary.py +3 -3
- anchorbrowser/resources/sessions/recordings/recordings.py +7 -7
- anchorbrowser/resources/sessions/sessions.py +345 -30
- anchorbrowser/resources/task/__init__.py +33 -0
- anchorbrowser/resources/task/run.py +225 -0
- anchorbrowser/resources/task/task.py +358 -0
- anchorbrowser/resources/tools.py +107 -37
- anchorbrowser/types/__init__.py +14 -1
- anchorbrowser/types/batch_session_create_params.py +487 -0
- anchorbrowser/types/batch_session_create_response.py +27 -0
- anchorbrowser/types/batch_session_retrieve_response.py +90 -0
- anchorbrowser/types/event_signal_params.py +13 -0
- anchorbrowser/types/event_wait_for_params.py +14 -0
- anchorbrowser/types/event_wait_for_response.py +12 -0
- anchorbrowser/types/extension_manifest.py +6 -1
- anchorbrowser/types/profile_create_params.py +3 -6
- anchorbrowser/types/profile_list_response.py +0 -3
- anchorbrowser/types/profile_retrieve_response.py +0 -3
- anchorbrowser/types/session_create_params.py +308 -29
- anchorbrowser/types/session_list_pages_response.py +25 -0
- anchorbrowser/types/session_retrieve_response.py +46 -0
- anchorbrowser/types/session_scroll_params.py +3 -0
- anchorbrowser/types/session_upload_file_params.py +14 -0
- anchorbrowser/types/session_upload_file_response.py +17 -0
- anchorbrowser/types/sessions/__init__.py +0 -4
- anchorbrowser/types/sessions/agent/__init__.py +7 -0
- anchorbrowser/types/sessions/agent/file_list_response.py +32 -0
- anchorbrowser/types/sessions/agent/file_upload_params.py +14 -0
- anchorbrowser/types/sessions/agent/file_upload_response.py +17 -0
- anchorbrowser/types/sessions/keyboard_shortcut_params.py +2 -2
- anchorbrowser/types/sessions/recording_list_response.py +4 -8
- anchorbrowser/types/task/__init__.py +6 -0
- anchorbrowser/types/task/run_execute_params.py +324 -0
- anchorbrowser/types/task/run_execute_response.py +33 -0
- anchorbrowser/types/task_create_params.py +317 -0
- anchorbrowser/types/task_create_response.py +345 -0
- anchorbrowser/types/task_list_params.py +15 -0
- anchorbrowser/types/task_list_response.py +361 -0
- anchorbrowser/types/tool_fetch_webpage_params.py +15 -0
- anchorbrowser/types/tool_perform_web_task_params.py +17 -1
- anchorbrowser/types/tool_perform_web_task_response.py +3 -3
- {anchorbrowser-0.1.0a3.dist-info → anchorbrowser-0.2.0.dist-info}/METADATA +13 -14
- anchorbrowser-0.2.0.dist-info/RECORD +126 -0
- anchorbrowser/types/profile_update_params.py +0 -27
- anchorbrowser/types/sessions/mouse_down_params.py +0 -18
- anchorbrowser/types/sessions/mouse_down_response.py +0 -11
- anchorbrowser/types/sessions/mouse_up_params.py +0 -18
- anchorbrowser/types/sessions/mouse_up_response.py +0 -11
- anchorbrowser-0.1.0a3.dist-info/RECORD +0 -100
- {anchorbrowser-0.1.0a3.dist-info → anchorbrowser-0.2.0.dist-info}/WHEEL +0 -0
- {anchorbrowser-0.1.0a3.dist-info → anchorbrowser-0.2.0.dist-info}/licenses/LICENSE +0 -0
|
@@ -0,0 +1,270 @@
|
|
|
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 event_signal_params, event_wait_for_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.event_wait_for_response import EventWaitForResponse
|
|
22
|
+
from ..types.shared.success_response import SuccessResponse
|
|
23
|
+
|
|
24
|
+
__all__ = ["EventsResource", "AsyncEventsResource"]
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
class EventsResource(SyncAPIResource):
|
|
28
|
+
@cached_property
|
|
29
|
+
def with_raw_response(self) -> EventsResourceWithRawResponse:
|
|
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 EventsResourceWithRawResponse(self)
|
|
37
|
+
|
|
38
|
+
@cached_property
|
|
39
|
+
def with_streaming_response(self) -> EventsResourceWithStreamingResponse:
|
|
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 EventsResourceWithStreamingResponse(self)
|
|
46
|
+
|
|
47
|
+
def signal(
|
|
48
|
+
self,
|
|
49
|
+
event_name: str,
|
|
50
|
+
*,
|
|
51
|
+
data: Dict[str, object],
|
|
52
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
53
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
54
|
+
extra_headers: Headers | None = None,
|
|
55
|
+
extra_query: Query | None = None,
|
|
56
|
+
extra_body: Body | None = None,
|
|
57
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
58
|
+
) -> SuccessResponse:
|
|
59
|
+
"""
|
|
60
|
+
Signals an event with associated data, unblocking any clients waiting for this
|
|
61
|
+
event. This enables coordination between different browser sessions, workflows,
|
|
62
|
+
or external processes.
|
|
63
|
+
|
|
64
|
+
Args:
|
|
65
|
+
data: Event data to be passed to waiting clients
|
|
66
|
+
|
|
67
|
+
extra_headers: Send extra headers
|
|
68
|
+
|
|
69
|
+
extra_query: Add additional query parameters to the request
|
|
70
|
+
|
|
71
|
+
extra_body: Add additional JSON properties to the request
|
|
72
|
+
|
|
73
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
74
|
+
"""
|
|
75
|
+
if not event_name:
|
|
76
|
+
raise ValueError(f"Expected a non-empty value for `event_name` but received {event_name!r}")
|
|
77
|
+
return self._post(
|
|
78
|
+
f"/v1/events/{event_name}",
|
|
79
|
+
body=maybe_transform({"data": data}, event_signal_params.EventSignalParams),
|
|
80
|
+
options=make_request_options(
|
|
81
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
82
|
+
),
|
|
83
|
+
cast_to=SuccessResponse,
|
|
84
|
+
)
|
|
85
|
+
|
|
86
|
+
def wait_for(
|
|
87
|
+
self,
|
|
88
|
+
event_name: str,
|
|
89
|
+
*,
|
|
90
|
+
timeout_ms: int | Omit = omit,
|
|
91
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
92
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
93
|
+
extra_headers: Headers | None = None,
|
|
94
|
+
extra_query: Query | None = None,
|
|
95
|
+
extra_body: Body | None = None,
|
|
96
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
97
|
+
) -> EventWaitForResponse:
|
|
98
|
+
"""
|
|
99
|
+
Waits for a specific event to be signaled by another process, workflow, or
|
|
100
|
+
session. This endpoint blocks until the event is signaled or the timeout is
|
|
101
|
+
reached. Useful for coordinating between multiple browser sessions or workflows.
|
|
102
|
+
|
|
103
|
+
Args:
|
|
104
|
+
timeout_ms: Timeout in milliseconds to wait for the event. Defaults to 60000ms (1 minute).
|
|
105
|
+
|
|
106
|
+
extra_headers: Send extra headers
|
|
107
|
+
|
|
108
|
+
extra_query: Add additional query parameters to the request
|
|
109
|
+
|
|
110
|
+
extra_body: Add additional JSON properties to the request
|
|
111
|
+
|
|
112
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
113
|
+
"""
|
|
114
|
+
if not event_name:
|
|
115
|
+
raise ValueError(f"Expected a non-empty value for `event_name` but received {event_name!r}")
|
|
116
|
+
return self._post(
|
|
117
|
+
f"/v1/events/{event_name}/wait",
|
|
118
|
+
body=maybe_transform({"timeout_ms": timeout_ms}, event_wait_for_params.EventWaitForParams),
|
|
119
|
+
options=make_request_options(
|
|
120
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
121
|
+
),
|
|
122
|
+
cast_to=EventWaitForResponse,
|
|
123
|
+
)
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
class AsyncEventsResource(AsyncAPIResource):
|
|
127
|
+
@cached_property
|
|
128
|
+
def with_raw_response(self) -> AsyncEventsResourceWithRawResponse:
|
|
129
|
+
"""
|
|
130
|
+
This property can be used as a prefix for any HTTP method call to return
|
|
131
|
+
the raw response object instead of the parsed content.
|
|
132
|
+
|
|
133
|
+
For more information, see https://www.github.com/anchorbrowser/AnchorBrowser-SDK-Python#accessing-raw-response-data-eg-headers
|
|
134
|
+
"""
|
|
135
|
+
return AsyncEventsResourceWithRawResponse(self)
|
|
136
|
+
|
|
137
|
+
@cached_property
|
|
138
|
+
def with_streaming_response(self) -> AsyncEventsResourceWithStreamingResponse:
|
|
139
|
+
"""
|
|
140
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
|
141
|
+
|
|
142
|
+
For more information, see https://www.github.com/anchorbrowser/AnchorBrowser-SDK-Python#with_streaming_response
|
|
143
|
+
"""
|
|
144
|
+
return AsyncEventsResourceWithStreamingResponse(self)
|
|
145
|
+
|
|
146
|
+
async def signal(
|
|
147
|
+
self,
|
|
148
|
+
event_name: str,
|
|
149
|
+
*,
|
|
150
|
+
data: Dict[str, object],
|
|
151
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
152
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
153
|
+
extra_headers: Headers | None = None,
|
|
154
|
+
extra_query: Query | None = None,
|
|
155
|
+
extra_body: Body | None = None,
|
|
156
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
157
|
+
) -> SuccessResponse:
|
|
158
|
+
"""
|
|
159
|
+
Signals an event with associated data, unblocking any clients waiting for this
|
|
160
|
+
event. This enables coordination between different browser sessions, workflows,
|
|
161
|
+
or external processes.
|
|
162
|
+
|
|
163
|
+
Args:
|
|
164
|
+
data: Event data to be passed to waiting clients
|
|
165
|
+
|
|
166
|
+
extra_headers: Send extra headers
|
|
167
|
+
|
|
168
|
+
extra_query: Add additional query parameters to the request
|
|
169
|
+
|
|
170
|
+
extra_body: Add additional JSON properties to the request
|
|
171
|
+
|
|
172
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
173
|
+
"""
|
|
174
|
+
if not event_name:
|
|
175
|
+
raise ValueError(f"Expected a non-empty value for `event_name` but received {event_name!r}")
|
|
176
|
+
return await self._post(
|
|
177
|
+
f"/v1/events/{event_name}",
|
|
178
|
+
body=await async_maybe_transform({"data": data}, event_signal_params.EventSignalParams),
|
|
179
|
+
options=make_request_options(
|
|
180
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
181
|
+
),
|
|
182
|
+
cast_to=SuccessResponse,
|
|
183
|
+
)
|
|
184
|
+
|
|
185
|
+
async def wait_for(
|
|
186
|
+
self,
|
|
187
|
+
event_name: str,
|
|
188
|
+
*,
|
|
189
|
+
timeout_ms: int | Omit = omit,
|
|
190
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
191
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
192
|
+
extra_headers: Headers | None = None,
|
|
193
|
+
extra_query: Query | None = None,
|
|
194
|
+
extra_body: Body | None = None,
|
|
195
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
196
|
+
) -> EventWaitForResponse:
|
|
197
|
+
"""
|
|
198
|
+
Waits for a specific event to be signaled by another process, workflow, or
|
|
199
|
+
session. This endpoint blocks until the event is signaled or the timeout is
|
|
200
|
+
reached. Useful for coordinating between multiple browser sessions or workflows.
|
|
201
|
+
|
|
202
|
+
Args:
|
|
203
|
+
timeout_ms: Timeout in milliseconds to wait for the event. Defaults to 60000ms (1 minute).
|
|
204
|
+
|
|
205
|
+
extra_headers: Send extra headers
|
|
206
|
+
|
|
207
|
+
extra_query: Add additional query parameters to the request
|
|
208
|
+
|
|
209
|
+
extra_body: Add additional JSON properties to the request
|
|
210
|
+
|
|
211
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
212
|
+
"""
|
|
213
|
+
if not event_name:
|
|
214
|
+
raise ValueError(f"Expected a non-empty value for `event_name` but received {event_name!r}")
|
|
215
|
+
return await self._post(
|
|
216
|
+
f"/v1/events/{event_name}/wait",
|
|
217
|
+
body=await async_maybe_transform({"timeout_ms": timeout_ms}, event_wait_for_params.EventWaitForParams),
|
|
218
|
+
options=make_request_options(
|
|
219
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
220
|
+
),
|
|
221
|
+
cast_to=EventWaitForResponse,
|
|
222
|
+
)
|
|
223
|
+
|
|
224
|
+
|
|
225
|
+
class EventsResourceWithRawResponse:
|
|
226
|
+
def __init__(self, events: EventsResource) -> None:
|
|
227
|
+
self._events = events
|
|
228
|
+
|
|
229
|
+
self.signal = to_raw_response_wrapper(
|
|
230
|
+
events.signal,
|
|
231
|
+
)
|
|
232
|
+
self.wait_for = to_raw_response_wrapper(
|
|
233
|
+
events.wait_for,
|
|
234
|
+
)
|
|
235
|
+
|
|
236
|
+
|
|
237
|
+
class AsyncEventsResourceWithRawResponse:
|
|
238
|
+
def __init__(self, events: AsyncEventsResource) -> None:
|
|
239
|
+
self._events = events
|
|
240
|
+
|
|
241
|
+
self.signal = async_to_raw_response_wrapper(
|
|
242
|
+
events.signal,
|
|
243
|
+
)
|
|
244
|
+
self.wait_for = async_to_raw_response_wrapper(
|
|
245
|
+
events.wait_for,
|
|
246
|
+
)
|
|
247
|
+
|
|
248
|
+
|
|
249
|
+
class EventsResourceWithStreamingResponse:
|
|
250
|
+
def __init__(self, events: EventsResource) -> None:
|
|
251
|
+
self._events = events
|
|
252
|
+
|
|
253
|
+
self.signal = to_streamed_response_wrapper(
|
|
254
|
+
events.signal,
|
|
255
|
+
)
|
|
256
|
+
self.wait_for = to_streamed_response_wrapper(
|
|
257
|
+
events.wait_for,
|
|
258
|
+
)
|
|
259
|
+
|
|
260
|
+
|
|
261
|
+
class AsyncEventsResourceWithStreamingResponse:
|
|
262
|
+
def __init__(self, events: AsyncEventsResource) -> None:
|
|
263
|
+
self._events = events
|
|
264
|
+
|
|
265
|
+
self.signal = async_to_streamed_response_wrapper(
|
|
266
|
+
events.signal,
|
|
267
|
+
)
|
|
268
|
+
self.wait_for = async_to_streamed_response_wrapper(
|
|
269
|
+
events.wait_for,
|
|
270
|
+
)
|
|
@@ -7,7 +7,7 @@ from typing import Mapping, cast
|
|
|
7
7
|
import httpx
|
|
8
8
|
|
|
9
9
|
from ..types import extension_upload_params
|
|
10
|
-
from .._types import
|
|
10
|
+
from .._types import Body, Query, Headers, NotGiven, FileTypes, not_given
|
|
11
11
|
from .._utils import extract_files, maybe_transform, deepcopy_minimal, async_maybe_transform
|
|
12
12
|
from .._compat import cached_property
|
|
13
13
|
from .._resource import SyncAPIResource, AsyncAPIResource
|
|
@@ -55,7 +55,7 @@ class ExtensionsResource(SyncAPIResource):
|
|
|
55
55
|
extra_headers: Headers | None = None,
|
|
56
56
|
extra_query: Query | None = None,
|
|
57
57
|
extra_body: Body | None = None,
|
|
58
|
-
timeout: float | httpx.Timeout | None | NotGiven =
|
|
58
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
59
59
|
) -> ExtensionRetrieveResponse:
|
|
60
60
|
"""
|
|
61
61
|
Get details of a specific extension by its ID
|
|
@@ -87,7 +87,7 @@ class ExtensionsResource(SyncAPIResource):
|
|
|
87
87
|
extra_headers: Headers | None = None,
|
|
88
88
|
extra_query: Query | None = None,
|
|
89
89
|
extra_body: Body | None = None,
|
|
90
|
-
timeout: float | httpx.Timeout | None | NotGiven =
|
|
90
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
91
91
|
) -> ExtensionListResponse:
|
|
92
92
|
"""Get all extensions for the authenticated user"""
|
|
93
93
|
return self._get(
|
|
@@ -107,7 +107,7 @@ class ExtensionsResource(SyncAPIResource):
|
|
|
107
107
|
extra_headers: Headers | None = None,
|
|
108
108
|
extra_query: Query | None = None,
|
|
109
109
|
extra_body: Body | None = None,
|
|
110
|
-
timeout: float | httpx.Timeout | None | NotGiven =
|
|
110
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
111
111
|
) -> ExtensionDeleteResponse:
|
|
112
112
|
"""
|
|
113
113
|
Delete an extension and remove it from storage
|
|
@@ -141,7 +141,7 @@ class ExtensionsResource(SyncAPIResource):
|
|
|
141
141
|
extra_headers: Headers | None = None,
|
|
142
142
|
extra_query: Query | None = None,
|
|
143
143
|
extra_body: Body | None = None,
|
|
144
|
-
timeout: float | httpx.Timeout | None | NotGiven =
|
|
144
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
145
145
|
) -> ExtensionUploadResponse:
|
|
146
146
|
"""Upload a new browser extension as a ZIP file.
|
|
147
147
|
|
|
@@ -212,7 +212,7 @@ class AsyncExtensionsResource(AsyncAPIResource):
|
|
|
212
212
|
extra_headers: Headers | None = None,
|
|
213
213
|
extra_query: Query | None = None,
|
|
214
214
|
extra_body: Body | None = None,
|
|
215
|
-
timeout: float | httpx.Timeout | None | NotGiven =
|
|
215
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
216
216
|
) -> ExtensionRetrieveResponse:
|
|
217
217
|
"""
|
|
218
218
|
Get details of a specific extension by its ID
|
|
@@ -244,7 +244,7 @@ class AsyncExtensionsResource(AsyncAPIResource):
|
|
|
244
244
|
extra_headers: Headers | None = None,
|
|
245
245
|
extra_query: Query | None = None,
|
|
246
246
|
extra_body: Body | None = None,
|
|
247
|
-
timeout: float | httpx.Timeout | None | NotGiven =
|
|
247
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
248
248
|
) -> ExtensionListResponse:
|
|
249
249
|
"""Get all extensions for the authenticated user"""
|
|
250
250
|
return await self._get(
|
|
@@ -264,7 +264,7 @@ class AsyncExtensionsResource(AsyncAPIResource):
|
|
|
264
264
|
extra_headers: Headers | None = None,
|
|
265
265
|
extra_query: Query | None = None,
|
|
266
266
|
extra_body: Body | None = None,
|
|
267
|
-
timeout: float | httpx.Timeout | None | NotGiven =
|
|
267
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
268
268
|
) -> ExtensionDeleteResponse:
|
|
269
269
|
"""
|
|
270
270
|
Delete an extension and remove it from storage
|
|
@@ -298,7 +298,7 @@ class AsyncExtensionsResource(AsyncAPIResource):
|
|
|
298
298
|
extra_headers: Headers | None = None,
|
|
299
299
|
extra_query: Query | None = None,
|
|
300
300
|
extra_body: Body | None = None,
|
|
301
|
-
timeout: float | httpx.Timeout | None | NotGiven =
|
|
301
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
302
302
|
) -> ExtensionUploadResponse:
|
|
303
303
|
"""Upload a new browser extension as a ZIP file.
|
|
304
304
|
|
|
@@ -6,8 +6,8 @@ from typing_extensions import Literal
|
|
|
6
6
|
|
|
7
7
|
import httpx
|
|
8
8
|
|
|
9
|
-
from ..types import profile_create_params
|
|
10
|
-
from .._types import
|
|
9
|
+
from ..types import profile_create_params
|
|
10
|
+
from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given
|
|
11
11
|
from .._utils import maybe_transform, async_maybe_transform
|
|
12
12
|
from .._compat import cached_property
|
|
13
13
|
from .._resource import SyncAPIResource, AsyncAPIResource
|
|
@@ -49,16 +49,16 @@ class ProfilesResource(SyncAPIResource):
|
|
|
49
49
|
self,
|
|
50
50
|
*,
|
|
51
51
|
name: str,
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
52
|
+
dedicated_sticky_ip: bool | Omit = omit,
|
|
53
|
+
description: str | Omit = omit,
|
|
54
|
+
session_id: str | Omit = omit,
|
|
55
|
+
source: Literal["session"] | Omit = omit,
|
|
56
56
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
57
57
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
58
58
|
extra_headers: Headers | None = None,
|
|
59
59
|
extra_query: Query | None = None,
|
|
60
60
|
extra_body: Body | None = None,
|
|
61
|
-
timeout: float | httpx.Timeout | None | NotGiven =
|
|
61
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
62
62
|
) -> SuccessResponse:
|
|
63
63
|
"""Creates a new profile from a browser session.
|
|
64
64
|
|
|
@@ -68,6 +68,8 @@ class ProfilesResource(SyncAPIResource):
|
|
|
68
68
|
Args:
|
|
69
69
|
name: The name of the profile.
|
|
70
70
|
|
|
71
|
+
dedicated_sticky_ip: Whether to use a dedicated sticky IP for this profile. Defaults to false.
|
|
72
|
+
|
|
71
73
|
description: A description of the profile.
|
|
72
74
|
|
|
73
75
|
session_id: The browser session ID is required if the source is set to `session`. The
|
|
@@ -76,9 +78,6 @@ class ProfilesResource(SyncAPIResource):
|
|
|
76
78
|
|
|
77
79
|
source: The source of the profile data. currently only `session` is supported.
|
|
78
80
|
|
|
79
|
-
store_cache: Indicates whether the browser session cache should be saved when the browser
|
|
80
|
-
session ends. Defaults to `false`.
|
|
81
|
-
|
|
82
81
|
extra_headers: Send extra headers
|
|
83
82
|
|
|
84
83
|
extra_query: Add additional query parameters to the request
|
|
@@ -92,10 +91,10 @@ class ProfilesResource(SyncAPIResource):
|
|
|
92
91
|
body=maybe_transform(
|
|
93
92
|
{
|
|
94
93
|
"name": name,
|
|
94
|
+
"dedicated_sticky_ip": dedicated_sticky_ip,
|
|
95
95
|
"description": description,
|
|
96
96
|
"session_id": session_id,
|
|
97
97
|
"source": source,
|
|
98
|
-
"store_cache": store_cache,
|
|
99
98
|
},
|
|
100
99
|
profile_create_params.ProfileCreateParams,
|
|
101
100
|
),
|
|
@@ -114,7 +113,7 @@ class ProfilesResource(SyncAPIResource):
|
|
|
114
113
|
extra_headers: Headers | None = None,
|
|
115
114
|
extra_query: Query | None = None,
|
|
116
115
|
extra_body: Body | None = None,
|
|
117
|
-
timeout: float | httpx.Timeout | None | NotGiven =
|
|
116
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
118
117
|
) -> ProfileRetrieveResponse:
|
|
119
118
|
"""
|
|
120
119
|
Retrieves details of a specific profile by its name.
|
|
@@ -138,62 +137,6 @@ class ProfilesResource(SyncAPIResource):
|
|
|
138
137
|
cast_to=ProfileRetrieveResponse,
|
|
139
138
|
)
|
|
140
139
|
|
|
141
|
-
def update(
|
|
142
|
-
self,
|
|
143
|
-
name: str,
|
|
144
|
-
*,
|
|
145
|
-
description: str | NotGiven = NOT_GIVEN,
|
|
146
|
-
session_id: str | NotGiven = NOT_GIVEN,
|
|
147
|
-
source: Literal["session"] | NotGiven = NOT_GIVEN,
|
|
148
|
-
store_cache: bool | NotGiven = NOT_GIVEN,
|
|
149
|
-
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
150
|
-
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
151
|
-
extra_headers: Headers | None = None,
|
|
152
|
-
extra_query: Query | None = None,
|
|
153
|
-
extra_body: Body | None = None,
|
|
154
|
-
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
155
|
-
) -> SuccessResponse:
|
|
156
|
-
"""
|
|
157
|
-
Updates the description or data of an existing profile using a browser session.
|
|
158
|
-
|
|
159
|
-
Args:
|
|
160
|
-
description: The new description for the profile.
|
|
161
|
-
|
|
162
|
-
session_id: The browser session ID is required if the source is set to `session`. The
|
|
163
|
-
browser session must belong to the user and be active.
|
|
164
|
-
|
|
165
|
-
source: The source of the profile data. Currently, only `session` is supported.
|
|
166
|
-
|
|
167
|
-
store_cache: Indicates whether the browser session cache should be saved when the browser
|
|
168
|
-
session ends. Defaults to `false`.
|
|
169
|
-
|
|
170
|
-
extra_headers: Send extra headers
|
|
171
|
-
|
|
172
|
-
extra_query: Add additional query parameters to the request
|
|
173
|
-
|
|
174
|
-
extra_body: Add additional JSON properties to the request
|
|
175
|
-
|
|
176
|
-
timeout: Override the client-level default timeout for this request, in seconds
|
|
177
|
-
"""
|
|
178
|
-
if not name:
|
|
179
|
-
raise ValueError(f"Expected a non-empty value for `name` but received {name!r}")
|
|
180
|
-
return self._put(
|
|
181
|
-
f"/v1/profiles/{name}",
|
|
182
|
-
body=maybe_transform(
|
|
183
|
-
{
|
|
184
|
-
"description": description,
|
|
185
|
-
"session_id": session_id,
|
|
186
|
-
"source": source,
|
|
187
|
-
"store_cache": store_cache,
|
|
188
|
-
},
|
|
189
|
-
profile_update_params.ProfileUpdateParams,
|
|
190
|
-
),
|
|
191
|
-
options=make_request_options(
|
|
192
|
-
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
193
|
-
),
|
|
194
|
-
cast_to=SuccessResponse,
|
|
195
|
-
)
|
|
196
|
-
|
|
197
140
|
def list(
|
|
198
141
|
self,
|
|
199
142
|
*,
|
|
@@ -202,7 +145,7 @@ class ProfilesResource(SyncAPIResource):
|
|
|
202
145
|
extra_headers: Headers | None = None,
|
|
203
146
|
extra_query: Query | None = None,
|
|
204
147
|
extra_body: Body | None = None,
|
|
205
|
-
timeout: float | httpx.Timeout | None | NotGiven =
|
|
148
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
206
149
|
) -> ProfileListResponse:
|
|
207
150
|
"""Fetches all stored profiles."""
|
|
208
151
|
return self._get(
|
|
@@ -222,7 +165,7 @@ class ProfilesResource(SyncAPIResource):
|
|
|
222
165
|
extra_headers: Headers | None = None,
|
|
223
166
|
extra_query: Query | None = None,
|
|
224
167
|
extra_body: Body | None = None,
|
|
225
|
-
timeout: float | httpx.Timeout | None | NotGiven =
|
|
168
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
226
169
|
) -> SuccessResponse:
|
|
227
170
|
"""
|
|
228
171
|
Deletes an existing profile by its name.
|
|
@@ -271,16 +214,16 @@ class AsyncProfilesResource(AsyncAPIResource):
|
|
|
271
214
|
self,
|
|
272
215
|
*,
|
|
273
216
|
name: str,
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
217
|
+
dedicated_sticky_ip: bool | Omit = omit,
|
|
218
|
+
description: str | Omit = omit,
|
|
219
|
+
session_id: str | Omit = omit,
|
|
220
|
+
source: Literal["session"] | Omit = omit,
|
|
278
221
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
279
222
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
280
223
|
extra_headers: Headers | None = None,
|
|
281
224
|
extra_query: Query | None = None,
|
|
282
225
|
extra_body: Body | None = None,
|
|
283
|
-
timeout: float | httpx.Timeout | None | NotGiven =
|
|
226
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
284
227
|
) -> SuccessResponse:
|
|
285
228
|
"""Creates a new profile from a browser session.
|
|
286
229
|
|
|
@@ -290,6 +233,8 @@ class AsyncProfilesResource(AsyncAPIResource):
|
|
|
290
233
|
Args:
|
|
291
234
|
name: The name of the profile.
|
|
292
235
|
|
|
236
|
+
dedicated_sticky_ip: Whether to use a dedicated sticky IP for this profile. Defaults to false.
|
|
237
|
+
|
|
293
238
|
description: A description of the profile.
|
|
294
239
|
|
|
295
240
|
session_id: The browser session ID is required if the source is set to `session`. The
|
|
@@ -298,9 +243,6 @@ class AsyncProfilesResource(AsyncAPIResource):
|
|
|
298
243
|
|
|
299
244
|
source: The source of the profile data. currently only `session` is supported.
|
|
300
245
|
|
|
301
|
-
store_cache: Indicates whether the browser session cache should be saved when the browser
|
|
302
|
-
session ends. Defaults to `false`.
|
|
303
|
-
|
|
304
246
|
extra_headers: Send extra headers
|
|
305
247
|
|
|
306
248
|
extra_query: Add additional query parameters to the request
|
|
@@ -314,10 +256,10 @@ class AsyncProfilesResource(AsyncAPIResource):
|
|
|
314
256
|
body=await async_maybe_transform(
|
|
315
257
|
{
|
|
316
258
|
"name": name,
|
|
259
|
+
"dedicated_sticky_ip": dedicated_sticky_ip,
|
|
317
260
|
"description": description,
|
|
318
261
|
"session_id": session_id,
|
|
319
262
|
"source": source,
|
|
320
|
-
"store_cache": store_cache,
|
|
321
263
|
},
|
|
322
264
|
profile_create_params.ProfileCreateParams,
|
|
323
265
|
),
|
|
@@ -336,7 +278,7 @@ class AsyncProfilesResource(AsyncAPIResource):
|
|
|
336
278
|
extra_headers: Headers | None = None,
|
|
337
279
|
extra_query: Query | None = None,
|
|
338
280
|
extra_body: Body | None = None,
|
|
339
|
-
timeout: float | httpx.Timeout | None | NotGiven =
|
|
281
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
340
282
|
) -> ProfileRetrieveResponse:
|
|
341
283
|
"""
|
|
342
284
|
Retrieves details of a specific profile by its name.
|
|
@@ -360,62 +302,6 @@ class AsyncProfilesResource(AsyncAPIResource):
|
|
|
360
302
|
cast_to=ProfileRetrieveResponse,
|
|
361
303
|
)
|
|
362
304
|
|
|
363
|
-
async def update(
|
|
364
|
-
self,
|
|
365
|
-
name: str,
|
|
366
|
-
*,
|
|
367
|
-
description: str | NotGiven = NOT_GIVEN,
|
|
368
|
-
session_id: str | NotGiven = NOT_GIVEN,
|
|
369
|
-
source: Literal["session"] | NotGiven = NOT_GIVEN,
|
|
370
|
-
store_cache: bool | NotGiven = NOT_GIVEN,
|
|
371
|
-
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
372
|
-
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
373
|
-
extra_headers: Headers | None = None,
|
|
374
|
-
extra_query: Query | None = None,
|
|
375
|
-
extra_body: Body | None = None,
|
|
376
|
-
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
377
|
-
) -> SuccessResponse:
|
|
378
|
-
"""
|
|
379
|
-
Updates the description or data of an existing profile using a browser session.
|
|
380
|
-
|
|
381
|
-
Args:
|
|
382
|
-
description: The new description for the profile.
|
|
383
|
-
|
|
384
|
-
session_id: The browser session ID is required if the source is set to `session`. The
|
|
385
|
-
browser session must belong to the user and be active.
|
|
386
|
-
|
|
387
|
-
source: The source of the profile data. Currently, only `session` is supported.
|
|
388
|
-
|
|
389
|
-
store_cache: Indicates whether the browser session cache should be saved when the browser
|
|
390
|
-
session ends. Defaults to `false`.
|
|
391
|
-
|
|
392
|
-
extra_headers: Send extra headers
|
|
393
|
-
|
|
394
|
-
extra_query: Add additional query parameters to the request
|
|
395
|
-
|
|
396
|
-
extra_body: Add additional JSON properties to the request
|
|
397
|
-
|
|
398
|
-
timeout: Override the client-level default timeout for this request, in seconds
|
|
399
|
-
"""
|
|
400
|
-
if not name:
|
|
401
|
-
raise ValueError(f"Expected a non-empty value for `name` but received {name!r}")
|
|
402
|
-
return await self._put(
|
|
403
|
-
f"/v1/profiles/{name}",
|
|
404
|
-
body=await async_maybe_transform(
|
|
405
|
-
{
|
|
406
|
-
"description": description,
|
|
407
|
-
"session_id": session_id,
|
|
408
|
-
"source": source,
|
|
409
|
-
"store_cache": store_cache,
|
|
410
|
-
},
|
|
411
|
-
profile_update_params.ProfileUpdateParams,
|
|
412
|
-
),
|
|
413
|
-
options=make_request_options(
|
|
414
|
-
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
415
|
-
),
|
|
416
|
-
cast_to=SuccessResponse,
|
|
417
|
-
)
|
|
418
|
-
|
|
419
305
|
async def list(
|
|
420
306
|
self,
|
|
421
307
|
*,
|
|
@@ -424,7 +310,7 @@ class AsyncProfilesResource(AsyncAPIResource):
|
|
|
424
310
|
extra_headers: Headers | None = None,
|
|
425
311
|
extra_query: Query | None = None,
|
|
426
312
|
extra_body: Body | None = None,
|
|
427
|
-
timeout: float | httpx.Timeout | None | NotGiven =
|
|
313
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
428
314
|
) -> ProfileListResponse:
|
|
429
315
|
"""Fetches all stored profiles."""
|
|
430
316
|
return await self._get(
|
|
@@ -444,7 +330,7 @@ class AsyncProfilesResource(AsyncAPIResource):
|
|
|
444
330
|
extra_headers: Headers | None = None,
|
|
445
331
|
extra_query: Query | None = None,
|
|
446
332
|
extra_body: Body | None = None,
|
|
447
|
-
timeout: float | httpx.Timeout | None | NotGiven =
|
|
333
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
448
334
|
) -> SuccessResponse:
|
|
449
335
|
"""
|
|
450
336
|
Deletes an existing profile by its name.
|
|
@@ -479,9 +365,6 @@ class ProfilesResourceWithRawResponse:
|
|
|
479
365
|
self.retrieve = to_raw_response_wrapper(
|
|
480
366
|
profiles.retrieve,
|
|
481
367
|
)
|
|
482
|
-
self.update = to_raw_response_wrapper(
|
|
483
|
-
profiles.update,
|
|
484
|
-
)
|
|
485
368
|
self.list = to_raw_response_wrapper(
|
|
486
369
|
profiles.list,
|
|
487
370
|
)
|
|
@@ -500,9 +383,6 @@ class AsyncProfilesResourceWithRawResponse:
|
|
|
500
383
|
self.retrieve = async_to_raw_response_wrapper(
|
|
501
384
|
profiles.retrieve,
|
|
502
385
|
)
|
|
503
|
-
self.update = async_to_raw_response_wrapper(
|
|
504
|
-
profiles.update,
|
|
505
|
-
)
|
|
506
386
|
self.list = async_to_raw_response_wrapper(
|
|
507
387
|
profiles.list,
|
|
508
388
|
)
|
|
@@ -521,9 +401,6 @@ class ProfilesResourceWithStreamingResponse:
|
|
|
521
401
|
self.retrieve = to_streamed_response_wrapper(
|
|
522
402
|
profiles.retrieve,
|
|
523
403
|
)
|
|
524
|
-
self.update = to_streamed_response_wrapper(
|
|
525
|
-
profiles.update,
|
|
526
|
-
)
|
|
527
404
|
self.list = to_streamed_response_wrapper(
|
|
528
405
|
profiles.list,
|
|
529
406
|
)
|
|
@@ -542,9 +419,6 @@ class AsyncProfilesResourceWithStreamingResponse:
|
|
|
542
419
|
self.retrieve = async_to_streamed_response_wrapper(
|
|
543
420
|
profiles.retrieve,
|
|
544
421
|
)
|
|
545
|
-
self.update = async_to_streamed_response_wrapper(
|
|
546
|
-
profiles.update,
|
|
547
|
-
)
|
|
548
422
|
self.list = async_to_streamed_response_wrapper(
|
|
549
423
|
profiles.list,
|
|
550
424
|
)
|