anchorbrowser 0.1.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 +100 -0
- anchorbrowser/_base_client.py +1995 -0
- anchorbrowser/_client.py +440 -0
- anchorbrowser/_compat.py +219 -0
- anchorbrowser/_constants.py +14 -0
- anchorbrowser/_exceptions.py +108 -0
- anchorbrowser/_files.py +123 -0
- anchorbrowser/_models.py +829 -0
- anchorbrowser/_qs.py +150 -0
- anchorbrowser/_resource.py +43 -0
- anchorbrowser/_response.py +832 -0
- anchorbrowser/_streaming.py +333 -0
- anchorbrowser/_types.py +219 -0
- anchorbrowser/_utils/__init__.py +57 -0
- anchorbrowser/_utils/_logs.py +25 -0
- anchorbrowser/_utils/_proxy.py +65 -0
- anchorbrowser/_utils/_reflection.py +42 -0
- anchorbrowser/_utils/_resources_proxy.py +24 -0
- anchorbrowser/_utils/_streams.py +12 -0
- anchorbrowser/_utils/_sync.py +86 -0
- anchorbrowser/_utils/_transform.py +447 -0
- anchorbrowser/_utils/_typing.py +151 -0
- anchorbrowser/_utils/_utils.py +422 -0
- anchorbrowser/_version.py +4 -0
- anchorbrowser/lib/.keep +4 -0
- anchorbrowser/lib/agent.py +69 -0
- anchorbrowser/lib/browser.py +186 -0
- anchorbrowser/py.typed +0 -0
- anchorbrowser/resources/__init__.py +61 -0
- anchorbrowser/resources/agent.py +305 -0
- anchorbrowser/resources/browser.py +152 -0
- anchorbrowser/resources/extensions.py +412 -0
- anchorbrowser/resources/profiles.py +553 -0
- anchorbrowser/resources/sessions/__init__.py +89 -0
- anchorbrowser/resources/sessions/all.py +192 -0
- anchorbrowser/resources/sessions/clipboard.py +252 -0
- anchorbrowser/resources/sessions/keyboard.py +298 -0
- anchorbrowser/resources/sessions/mouse.py +651 -0
- anchorbrowser/resources/sessions/recordings/__init__.py +33 -0
- anchorbrowser/resources/sessions/recordings/primary.py +176 -0
- anchorbrowser/resources/sessions/recordings/recordings.py +357 -0
- anchorbrowser/resources/sessions/sessions.py +1122 -0
- anchorbrowser/resources/tools.py +529 -0
- anchorbrowser/types/__init__.py +32 -0
- anchorbrowser/types/extension_delete_response.py +12 -0
- anchorbrowser/types/extension_list_response.py +31 -0
- anchorbrowser/types/extension_manifest.py +28 -0
- anchorbrowser/types/extension_retrieve_response.py +27 -0
- anchorbrowser/types/extension_upload_params.py +17 -0
- anchorbrowser/types/extension_upload_response.py +31 -0
- anchorbrowser/types/profile_create_params.py +31 -0
- anchorbrowser/types/profile_list_response.py +43 -0
- anchorbrowser/types/profile_retrieve_response.py +36 -0
- anchorbrowser/types/profile_update_params.py +27 -0
- anchorbrowser/types/session_copy_response.py +12 -0
- anchorbrowser/types/session_create_params.py +196 -0
- anchorbrowser/types/session_create_response.py +22 -0
- anchorbrowser/types/session_drag_and_drop_params.py +26 -0
- anchorbrowser/types/session_drag_and_drop_response.py +11 -0
- anchorbrowser/types/session_goto_params.py +12 -0
- anchorbrowser/types/session_goto_response.py +11 -0
- anchorbrowser/types/session_paste_params.py +12 -0
- anchorbrowser/types/session_paste_response.py +11 -0
- anchorbrowser/types/session_retrieve_downloads_response.py +51 -0
- anchorbrowser/types/session_scroll_params.py +26 -0
- anchorbrowser/types/session_scroll_response.py +11 -0
- anchorbrowser/types/sessions/__init__.py +25 -0
- anchorbrowser/types/sessions/all_status_response.py +30 -0
- anchorbrowser/types/sessions/clipboard_get_response.py +16 -0
- anchorbrowser/types/sessions/clipboard_set_params.py +12 -0
- anchorbrowser/types/sessions/clipboard_set_response.py +11 -0
- anchorbrowser/types/sessions/keyboard_shortcut_params.py +18 -0
- anchorbrowser/types/sessions/keyboard_shortcut_response.py +11 -0
- anchorbrowser/types/sessions/keyboard_type_params.py +15 -0
- anchorbrowser/types/sessions/keyboard_type_response.py +11 -0
- anchorbrowser/types/sessions/mouse_click_params.py +18 -0
- anchorbrowser/types/sessions/mouse_click_response.py +11 -0
- anchorbrowser/types/sessions/mouse_double_click_params.py +18 -0
- anchorbrowser/types/sessions/mouse_double_click_response.py +11 -0
- anchorbrowser/types/sessions/mouse_down_params.py +18 -0
- anchorbrowser/types/sessions/mouse_down_response.py +11 -0
- anchorbrowser/types/sessions/mouse_move_params.py +15 -0
- anchorbrowser/types/sessions/mouse_move_response.py +11 -0
- anchorbrowser/types/sessions/mouse_up_params.py +18 -0
- anchorbrowser/types/sessions/mouse_up_response.py +11 -0
- anchorbrowser/types/sessions/recording_list_response.py +46 -0
- anchorbrowser/types/sessions/recording_pause_response.py +12 -0
- anchorbrowser/types/sessions/recording_resume_response.py +12 -0
- anchorbrowser/types/sessions/recordings/__init__.py +3 -0
- anchorbrowser/types/shared/__init__.py +3 -0
- anchorbrowser/types/shared/success_response.py +15 -0
- anchorbrowser/types/tool_fetch_webpage_params.py +26 -0
- anchorbrowser/types/tool_fetch_webpage_response.py +7 -0
- anchorbrowser/types/tool_perform_web_task_params.py +30 -0
- anchorbrowser/types/tool_perform_web_task_response.py +16 -0
- anchorbrowser/types/tool_screenshot_webpage_params.py +48 -0
- anchorbrowser-0.1.0.dist-info/METADATA +449 -0
- anchorbrowser-0.1.0.dist-info/RECORD +100 -0
- anchorbrowser-0.1.0.dist-info/WHEEL +4 -0
- anchorbrowser-0.1.0.dist-info/licenses/LICENSE +201 -0
|
@@ -0,0 +1,298 @@
|
|
|
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 List
|
|
6
|
+
|
|
7
|
+
import httpx
|
|
8
|
+
|
|
9
|
+
from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven
|
|
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 ..._base_client import make_request_options
|
|
20
|
+
from ...types.sessions import keyboard_type_params, keyboard_shortcut_params
|
|
21
|
+
from ...types.sessions.keyboard_type_response import KeyboardTypeResponse
|
|
22
|
+
from ...types.sessions.keyboard_shortcut_response import KeyboardShortcutResponse
|
|
23
|
+
|
|
24
|
+
__all__ = ["KeyboardResource", "AsyncKeyboardResource"]
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
class KeyboardResource(SyncAPIResource):
|
|
28
|
+
@cached_property
|
|
29
|
+
def with_raw_response(self) -> KeyboardResourceWithRawResponse:
|
|
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 KeyboardResourceWithRawResponse(self)
|
|
37
|
+
|
|
38
|
+
@cached_property
|
|
39
|
+
def with_streaming_response(self) -> KeyboardResourceWithStreamingResponse:
|
|
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 KeyboardResourceWithStreamingResponse(self)
|
|
46
|
+
|
|
47
|
+
def shortcut(
|
|
48
|
+
self,
|
|
49
|
+
session_id: str,
|
|
50
|
+
*,
|
|
51
|
+
keys: List[str],
|
|
52
|
+
hold_time: int | NotGiven = NOT_GIVEN,
|
|
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
|
+
) -> KeyboardShortcutResponse:
|
|
60
|
+
"""
|
|
61
|
+
Performs a keyboard shortcut using the specified keys
|
|
62
|
+
|
|
63
|
+
Args:
|
|
64
|
+
keys: Array of keys to press simultaneously
|
|
65
|
+
|
|
66
|
+
hold_time: Time to hold the keys down in milliseconds
|
|
67
|
+
|
|
68
|
+
extra_headers: Send extra headers
|
|
69
|
+
|
|
70
|
+
extra_query: Add additional query parameters to the request
|
|
71
|
+
|
|
72
|
+
extra_body: Add additional JSON properties to the request
|
|
73
|
+
|
|
74
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
75
|
+
"""
|
|
76
|
+
if not session_id:
|
|
77
|
+
raise ValueError(f"Expected a non-empty value for `session_id` but received {session_id!r}")
|
|
78
|
+
return self._post(
|
|
79
|
+
f"/v1/sessions/{session_id}/keyboard/shortcut",
|
|
80
|
+
body=maybe_transform(
|
|
81
|
+
{
|
|
82
|
+
"keys": keys,
|
|
83
|
+
"hold_time": hold_time,
|
|
84
|
+
},
|
|
85
|
+
keyboard_shortcut_params.KeyboardShortcutParams,
|
|
86
|
+
),
|
|
87
|
+
options=make_request_options(
|
|
88
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
89
|
+
),
|
|
90
|
+
cast_to=KeyboardShortcutResponse,
|
|
91
|
+
)
|
|
92
|
+
|
|
93
|
+
def type(
|
|
94
|
+
self,
|
|
95
|
+
session_id: str,
|
|
96
|
+
*,
|
|
97
|
+
text: str,
|
|
98
|
+
delay: int | NotGiven = NOT_GIVEN,
|
|
99
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
100
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
101
|
+
extra_headers: Headers | None = None,
|
|
102
|
+
extra_query: Query | None = None,
|
|
103
|
+
extra_body: Body | None = None,
|
|
104
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
105
|
+
) -> KeyboardTypeResponse:
|
|
106
|
+
"""
|
|
107
|
+
Types the specified text with optional delay between keystrokes
|
|
108
|
+
|
|
109
|
+
Args:
|
|
110
|
+
text: Text to type
|
|
111
|
+
|
|
112
|
+
delay: Delay between keystrokes in milliseconds
|
|
113
|
+
|
|
114
|
+
extra_headers: Send extra headers
|
|
115
|
+
|
|
116
|
+
extra_query: Add additional query parameters to the request
|
|
117
|
+
|
|
118
|
+
extra_body: Add additional JSON properties to the request
|
|
119
|
+
|
|
120
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
121
|
+
"""
|
|
122
|
+
if not session_id:
|
|
123
|
+
raise ValueError(f"Expected a non-empty value for `session_id` but received {session_id!r}")
|
|
124
|
+
return self._post(
|
|
125
|
+
f"/v1/sessions/{session_id}/keyboard/type",
|
|
126
|
+
body=maybe_transform(
|
|
127
|
+
{
|
|
128
|
+
"text": text,
|
|
129
|
+
"delay": delay,
|
|
130
|
+
},
|
|
131
|
+
keyboard_type_params.KeyboardTypeParams,
|
|
132
|
+
),
|
|
133
|
+
options=make_request_options(
|
|
134
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
135
|
+
),
|
|
136
|
+
cast_to=KeyboardTypeResponse,
|
|
137
|
+
)
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
class AsyncKeyboardResource(AsyncAPIResource):
|
|
141
|
+
@cached_property
|
|
142
|
+
def with_raw_response(self) -> AsyncKeyboardResourceWithRawResponse:
|
|
143
|
+
"""
|
|
144
|
+
This property can be used as a prefix for any HTTP method call to return
|
|
145
|
+
the raw response object instead of the parsed content.
|
|
146
|
+
|
|
147
|
+
For more information, see https://www.github.com/anchorbrowser/AnchorBrowser-SDK-Python#accessing-raw-response-data-eg-headers
|
|
148
|
+
"""
|
|
149
|
+
return AsyncKeyboardResourceWithRawResponse(self)
|
|
150
|
+
|
|
151
|
+
@cached_property
|
|
152
|
+
def with_streaming_response(self) -> AsyncKeyboardResourceWithStreamingResponse:
|
|
153
|
+
"""
|
|
154
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
|
155
|
+
|
|
156
|
+
For more information, see https://www.github.com/anchorbrowser/AnchorBrowser-SDK-Python#with_streaming_response
|
|
157
|
+
"""
|
|
158
|
+
return AsyncKeyboardResourceWithStreamingResponse(self)
|
|
159
|
+
|
|
160
|
+
async def shortcut(
|
|
161
|
+
self,
|
|
162
|
+
session_id: str,
|
|
163
|
+
*,
|
|
164
|
+
keys: List[str],
|
|
165
|
+
hold_time: int | NotGiven = NOT_GIVEN,
|
|
166
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
167
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
168
|
+
extra_headers: Headers | None = None,
|
|
169
|
+
extra_query: Query | None = None,
|
|
170
|
+
extra_body: Body | None = None,
|
|
171
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
172
|
+
) -> KeyboardShortcutResponse:
|
|
173
|
+
"""
|
|
174
|
+
Performs a keyboard shortcut using the specified keys
|
|
175
|
+
|
|
176
|
+
Args:
|
|
177
|
+
keys: Array of keys to press simultaneously
|
|
178
|
+
|
|
179
|
+
hold_time: Time to hold the keys down in milliseconds
|
|
180
|
+
|
|
181
|
+
extra_headers: Send extra headers
|
|
182
|
+
|
|
183
|
+
extra_query: Add additional query parameters to the request
|
|
184
|
+
|
|
185
|
+
extra_body: Add additional JSON properties to the request
|
|
186
|
+
|
|
187
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
188
|
+
"""
|
|
189
|
+
if not session_id:
|
|
190
|
+
raise ValueError(f"Expected a non-empty value for `session_id` but received {session_id!r}")
|
|
191
|
+
return await self._post(
|
|
192
|
+
f"/v1/sessions/{session_id}/keyboard/shortcut",
|
|
193
|
+
body=await async_maybe_transform(
|
|
194
|
+
{
|
|
195
|
+
"keys": keys,
|
|
196
|
+
"hold_time": hold_time,
|
|
197
|
+
},
|
|
198
|
+
keyboard_shortcut_params.KeyboardShortcutParams,
|
|
199
|
+
),
|
|
200
|
+
options=make_request_options(
|
|
201
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
202
|
+
),
|
|
203
|
+
cast_to=KeyboardShortcutResponse,
|
|
204
|
+
)
|
|
205
|
+
|
|
206
|
+
async def type(
|
|
207
|
+
self,
|
|
208
|
+
session_id: str,
|
|
209
|
+
*,
|
|
210
|
+
text: str,
|
|
211
|
+
delay: int | NotGiven = NOT_GIVEN,
|
|
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
|
+
) -> KeyboardTypeResponse:
|
|
219
|
+
"""
|
|
220
|
+
Types the specified text with optional delay between keystrokes
|
|
221
|
+
|
|
222
|
+
Args:
|
|
223
|
+
text: Text to type
|
|
224
|
+
|
|
225
|
+
delay: Delay between keystrokes in milliseconds
|
|
226
|
+
|
|
227
|
+
extra_headers: Send extra headers
|
|
228
|
+
|
|
229
|
+
extra_query: Add additional query parameters to the request
|
|
230
|
+
|
|
231
|
+
extra_body: Add additional JSON properties to the request
|
|
232
|
+
|
|
233
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
234
|
+
"""
|
|
235
|
+
if not session_id:
|
|
236
|
+
raise ValueError(f"Expected a non-empty value for `session_id` but received {session_id!r}")
|
|
237
|
+
return await self._post(
|
|
238
|
+
f"/v1/sessions/{session_id}/keyboard/type",
|
|
239
|
+
body=await async_maybe_transform(
|
|
240
|
+
{
|
|
241
|
+
"text": text,
|
|
242
|
+
"delay": delay,
|
|
243
|
+
},
|
|
244
|
+
keyboard_type_params.KeyboardTypeParams,
|
|
245
|
+
),
|
|
246
|
+
options=make_request_options(
|
|
247
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
248
|
+
),
|
|
249
|
+
cast_to=KeyboardTypeResponse,
|
|
250
|
+
)
|
|
251
|
+
|
|
252
|
+
|
|
253
|
+
class KeyboardResourceWithRawResponse:
|
|
254
|
+
def __init__(self, keyboard: KeyboardResource) -> None:
|
|
255
|
+
self._keyboard = keyboard
|
|
256
|
+
|
|
257
|
+
self.shortcut = to_raw_response_wrapper(
|
|
258
|
+
keyboard.shortcut,
|
|
259
|
+
)
|
|
260
|
+
self.type = to_raw_response_wrapper(
|
|
261
|
+
keyboard.type,
|
|
262
|
+
)
|
|
263
|
+
|
|
264
|
+
|
|
265
|
+
class AsyncKeyboardResourceWithRawResponse:
|
|
266
|
+
def __init__(self, keyboard: AsyncKeyboardResource) -> None:
|
|
267
|
+
self._keyboard = keyboard
|
|
268
|
+
|
|
269
|
+
self.shortcut = async_to_raw_response_wrapper(
|
|
270
|
+
keyboard.shortcut,
|
|
271
|
+
)
|
|
272
|
+
self.type = async_to_raw_response_wrapper(
|
|
273
|
+
keyboard.type,
|
|
274
|
+
)
|
|
275
|
+
|
|
276
|
+
|
|
277
|
+
class KeyboardResourceWithStreamingResponse:
|
|
278
|
+
def __init__(self, keyboard: KeyboardResource) -> None:
|
|
279
|
+
self._keyboard = keyboard
|
|
280
|
+
|
|
281
|
+
self.shortcut = to_streamed_response_wrapper(
|
|
282
|
+
keyboard.shortcut,
|
|
283
|
+
)
|
|
284
|
+
self.type = to_streamed_response_wrapper(
|
|
285
|
+
keyboard.type,
|
|
286
|
+
)
|
|
287
|
+
|
|
288
|
+
|
|
289
|
+
class AsyncKeyboardResourceWithStreamingResponse:
|
|
290
|
+
def __init__(self, keyboard: AsyncKeyboardResource) -> None:
|
|
291
|
+
self._keyboard = keyboard
|
|
292
|
+
|
|
293
|
+
self.shortcut = async_to_streamed_response_wrapper(
|
|
294
|
+
keyboard.shortcut,
|
|
295
|
+
)
|
|
296
|
+
self.type = async_to_streamed_response_wrapper(
|
|
297
|
+
keyboard.type,
|
|
298
|
+
)
|