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.
Files changed (80) hide show
  1. anchorbrowser/__init__.py +3 -1
  2. anchorbrowser/_base_client.py +16 -13
  3. anchorbrowser/_client.py +38 -9
  4. anchorbrowser/_compat.py +48 -48
  5. anchorbrowser/_files.py +4 -4
  6. anchorbrowser/_models.py +54 -45
  7. anchorbrowser/_qs.py +7 -7
  8. anchorbrowser/_types.py +53 -12
  9. anchorbrowser/_utils/__init__.py +9 -2
  10. anchorbrowser/_utils/_compat.py +45 -0
  11. anchorbrowser/_utils/_datetime_parse.py +136 -0
  12. anchorbrowser/_utils/_transform.py +13 -3
  13. anchorbrowser/_utils/_typing.py +6 -1
  14. anchorbrowser/_utils/_utils.py +4 -5
  15. anchorbrowser/_version.py +1 -1
  16. anchorbrowser/lib/browser.py +1 -1
  17. anchorbrowser/resources/__init__.py +42 -0
  18. anchorbrowser/resources/batch_sessions.py +288 -0
  19. anchorbrowser/resources/events.py +270 -0
  20. anchorbrowser/resources/extensions.py +9 -9
  21. anchorbrowser/resources/profiles.py +24 -150
  22. anchorbrowser/resources/sessions/__init__.py +14 -0
  23. anchorbrowser/resources/sessions/agent/__init__.py +33 -0
  24. anchorbrowser/resources/sessions/agent/agent.py +273 -0
  25. anchorbrowser/resources/sessions/agent/files.py +280 -0
  26. anchorbrowser/resources/sessions/all.py +5 -5
  27. anchorbrowser/resources/sessions/clipboard.py +5 -5
  28. anchorbrowser/resources/sessions/keyboard.py +11 -13
  29. anchorbrowser/resources/sessions/mouse.py +12 -244
  30. anchorbrowser/resources/sessions/recordings/primary.py +3 -3
  31. anchorbrowser/resources/sessions/recordings/recordings.py +7 -7
  32. anchorbrowser/resources/sessions/sessions.py +345 -30
  33. anchorbrowser/resources/task/__init__.py +33 -0
  34. anchorbrowser/resources/task/run.py +225 -0
  35. anchorbrowser/resources/task/task.py +358 -0
  36. anchorbrowser/resources/tools.py +107 -37
  37. anchorbrowser/types/__init__.py +14 -1
  38. anchorbrowser/types/batch_session_create_params.py +487 -0
  39. anchorbrowser/types/batch_session_create_response.py +27 -0
  40. anchorbrowser/types/batch_session_retrieve_response.py +90 -0
  41. anchorbrowser/types/event_signal_params.py +13 -0
  42. anchorbrowser/types/event_wait_for_params.py +14 -0
  43. anchorbrowser/types/event_wait_for_response.py +12 -0
  44. anchorbrowser/types/extension_manifest.py +6 -1
  45. anchorbrowser/types/profile_create_params.py +3 -6
  46. anchorbrowser/types/profile_list_response.py +0 -3
  47. anchorbrowser/types/profile_retrieve_response.py +0 -3
  48. anchorbrowser/types/session_create_params.py +308 -29
  49. anchorbrowser/types/session_list_pages_response.py +25 -0
  50. anchorbrowser/types/session_retrieve_response.py +46 -0
  51. anchorbrowser/types/session_scroll_params.py +3 -0
  52. anchorbrowser/types/session_upload_file_params.py +14 -0
  53. anchorbrowser/types/session_upload_file_response.py +17 -0
  54. anchorbrowser/types/sessions/__init__.py +0 -4
  55. anchorbrowser/types/sessions/agent/__init__.py +7 -0
  56. anchorbrowser/types/sessions/agent/file_list_response.py +32 -0
  57. anchorbrowser/types/sessions/agent/file_upload_params.py +14 -0
  58. anchorbrowser/types/sessions/agent/file_upload_response.py +17 -0
  59. anchorbrowser/types/sessions/keyboard_shortcut_params.py +2 -2
  60. anchorbrowser/types/sessions/recording_list_response.py +4 -8
  61. anchorbrowser/types/task/__init__.py +6 -0
  62. anchorbrowser/types/task/run_execute_params.py +324 -0
  63. anchorbrowser/types/task/run_execute_response.py +33 -0
  64. anchorbrowser/types/task_create_params.py +317 -0
  65. anchorbrowser/types/task_create_response.py +345 -0
  66. anchorbrowser/types/task_list_params.py +15 -0
  67. anchorbrowser/types/task_list_response.py +361 -0
  68. anchorbrowser/types/tool_fetch_webpage_params.py +15 -0
  69. anchorbrowser/types/tool_perform_web_task_params.py +17 -1
  70. anchorbrowser/types/tool_perform_web_task_response.py +3 -3
  71. {anchorbrowser-0.1.0a3.dist-info → anchorbrowser-0.2.0.dist-info}/METADATA +13 -14
  72. anchorbrowser-0.2.0.dist-info/RECORD +126 -0
  73. anchorbrowser/types/profile_update_params.py +0 -27
  74. anchorbrowser/types/sessions/mouse_down_params.py +0 -18
  75. anchorbrowser/types/sessions/mouse_down_response.py +0 -11
  76. anchorbrowser/types/sessions/mouse_up_params.py +0 -18
  77. anchorbrowser/types/sessions/mouse_up_response.py +0 -11
  78. anchorbrowser-0.1.0a3.dist-info/RECORD +0 -100
  79. {anchorbrowser-0.1.0a3.dist-info → anchorbrowser-0.2.0.dist-info}/WHEEL +0 -0
  80. {anchorbrowser-0.1.0a3.dist-info → anchorbrowser-0.2.0.dist-info}/licenses/LICENSE +0 -0
@@ -7,7 +7,7 @@ from typing_extensions import Literal
7
7
  import httpx
8
8
 
9
9
  from ..types import tool_fetch_webpage_params, tool_perform_web_task_params, tool_screenshot_webpage_params
10
- from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven
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
@@ -54,15 +54,19 @@ class ToolsResource(SyncAPIResource):
54
54
  def fetch_webpage(
55
55
  self,
56
56
  *,
57
- session_id: str | NotGiven = NOT_GIVEN,
58
- format: Literal["html", "markdown"] | NotGiven = NOT_GIVEN,
59
- url: str | NotGiven = NOT_GIVEN,
57
+ session_id: str | Omit = omit,
58
+ format: Literal["html", "markdown"] | Omit = omit,
59
+ new_page: bool | Omit = omit,
60
+ page_index: int | Omit = omit,
61
+ return_partial_on_timeout: bool | Omit = omit,
62
+ url: str | Omit = omit,
63
+ wait: int | Omit = omit,
60
64
  # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
61
65
  # The extra values given here take precedence over values defined on the client or passed to this method.
62
66
  extra_headers: Headers | None = None,
63
67
  extra_query: Query | None = None,
64
68
  extra_body: Body | None = None,
65
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
69
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
66
70
  ) -> str:
67
71
  """
68
72
  Retrieve the rendered content of a webpage, optionally formatted as Markdown or
@@ -74,9 +78,18 @@ class ToolsResource(SyncAPIResource):
74
78
 
75
79
  format: The output format of the content.
76
80
 
81
+ new_page: Whether to create a new page for the content.
82
+
83
+ page_index: The index of the page to fetch content from. **Overides new_page**.
84
+
85
+ return_partial_on_timeout: Whether to return partial content if the content is not loaded within the 20
86
+ seconds.
87
+
77
88
  url: The URL of the webpage to fetch content from. When left empty, the current
78
89
  webpage is used.
79
90
 
91
+ wait: The time to wait for **dynamic** content to load in **milliseconds**.
92
+
80
93
  extra_headers: Send extra headers
81
94
 
82
95
  extra_query: Add additional query parameters to the request
@@ -91,7 +104,11 @@ class ToolsResource(SyncAPIResource):
91
104
  body=maybe_transform(
92
105
  {
93
106
  "format": format,
107
+ "new_page": new_page,
108
+ "page_index": page_index,
109
+ "return_partial_on_timeout": return_partial_on_timeout,
94
110
  "url": url,
111
+ "wait": wait,
95
112
  },
96
113
  tool_fetch_webpage_params.ToolFetchWebpageParams,
97
114
  ),
@@ -109,15 +126,19 @@ class ToolsResource(SyncAPIResource):
109
126
  self,
110
127
  *,
111
128
  prompt: str,
112
- session_id: str | NotGiven = NOT_GIVEN,
113
- output_schema: object | NotGiven = NOT_GIVEN,
114
- url: str | NotGiven = NOT_GIVEN,
129
+ session_id: str | Omit = omit,
130
+ agent: Literal["browser-use", "openai-cua"] | Omit = omit,
131
+ highlight_elements: bool | Omit = omit,
132
+ model: str | Omit = omit,
133
+ output_schema: object | Omit = omit,
134
+ provider: Literal["openai", "gemini", "groq", "azure", "xai"] | Omit = omit,
135
+ url: str | Omit = omit,
115
136
  # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
116
137
  # The extra values given here take precedence over values defined on the client or passed to this method.
117
138
  extra_headers: Headers | None = None,
118
139
  extra_query: Query | None = None,
119
140
  extra_body: Body | None = None,
120
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
141
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
121
142
  ) -> ToolPerformWebTaskResponse:
122
143
  """
123
144
  Start from a URL and perform the given task.
@@ -129,8 +150,18 @@ class ToolsResource(SyncAPIResource):
129
150
  sessions. When passed, the tool will be executed on the provided browser
130
151
  session.
131
152
 
153
+ agent: The AI agent to use for task completion. Defaults to browser-use.
154
+
155
+ highlight_elements: Whether to highlight elements during task execution for better visibility.
156
+
157
+ model: The specific model to use for task completion. see our
158
+ [models](/agentic-browser-control/ai-task-completion#available-models) page for
159
+ more information.
160
+
132
161
  output_schema: JSON Schema defining the expected structure of the output data.
133
162
 
163
+ provider: The AI provider to use for task completion.
164
+
134
165
  url: The URL of the webpage. If not provided, the tool will use the current page in
135
166
  the session.
136
167
 
@@ -147,7 +178,11 @@ class ToolsResource(SyncAPIResource):
147
178
  body=maybe_transform(
148
179
  {
149
180
  "prompt": prompt,
181
+ "agent": agent,
182
+ "highlight_elements": highlight_elements,
183
+ "model": model,
150
184
  "output_schema": output_schema,
185
+ "provider": provider,
151
186
  "url": url,
152
187
  },
153
188
  tool_perform_web_task_params.ToolPerformWebTaskParams,
@@ -167,21 +202,21 @@ class ToolsResource(SyncAPIResource):
167
202
  def screenshot_webpage(
168
203
  self,
169
204
  *,
170
- session_id: str | NotGiven = NOT_GIVEN,
171
- capture_full_height: bool | NotGiven = NOT_GIVEN,
172
- height: int | NotGiven = NOT_GIVEN,
173
- image_quality: int | NotGiven = NOT_GIVEN,
174
- s3_target_address: str | NotGiven = NOT_GIVEN,
175
- scroll_all_content: bool | NotGiven = NOT_GIVEN,
176
- url: str | NotGiven = NOT_GIVEN,
177
- wait: int | NotGiven = NOT_GIVEN,
178
- width: int | NotGiven = NOT_GIVEN,
205
+ session_id: str | Omit = omit,
206
+ capture_full_height: bool | Omit = omit,
207
+ height: int | Omit = omit,
208
+ image_quality: int | Omit = omit,
209
+ s3_target_address: str | Omit = omit,
210
+ scroll_all_content: bool | Omit = omit,
211
+ url: str | Omit = omit,
212
+ wait: int | Omit = omit,
213
+ width: int | Omit = omit,
179
214
  # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
180
215
  # The extra values given here take precedence over values defined on the client or passed to this method.
181
216
  extra_headers: Headers | None = None,
182
217
  extra_query: Query | None = None,
183
218
  extra_body: Body | None = None,
184
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
219
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
185
220
  ) -> BinaryAPIResponse:
186
221
  """
187
222
  This endpoint captures a screenshot of the specified webpage using Chromium.
@@ -270,15 +305,19 @@ class AsyncToolsResource(AsyncAPIResource):
270
305
  async def fetch_webpage(
271
306
  self,
272
307
  *,
273
- session_id: str | NotGiven = NOT_GIVEN,
274
- format: Literal["html", "markdown"] | NotGiven = NOT_GIVEN,
275
- url: str | NotGiven = NOT_GIVEN,
308
+ session_id: str | Omit = omit,
309
+ format: Literal["html", "markdown"] | Omit = omit,
310
+ new_page: bool | Omit = omit,
311
+ page_index: int | Omit = omit,
312
+ return_partial_on_timeout: bool | Omit = omit,
313
+ url: str | Omit = omit,
314
+ wait: int | Omit = omit,
276
315
  # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
277
316
  # The extra values given here take precedence over values defined on the client or passed to this method.
278
317
  extra_headers: Headers | None = None,
279
318
  extra_query: Query | None = None,
280
319
  extra_body: Body | None = None,
281
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
320
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
282
321
  ) -> str:
283
322
  """
284
323
  Retrieve the rendered content of a webpage, optionally formatted as Markdown or
@@ -290,9 +329,18 @@ class AsyncToolsResource(AsyncAPIResource):
290
329
 
291
330
  format: The output format of the content.
292
331
 
332
+ new_page: Whether to create a new page for the content.
333
+
334
+ page_index: The index of the page to fetch content from. **Overides new_page**.
335
+
336
+ return_partial_on_timeout: Whether to return partial content if the content is not loaded within the 20
337
+ seconds.
338
+
293
339
  url: The URL of the webpage to fetch content from. When left empty, the current
294
340
  webpage is used.
295
341
 
342
+ wait: The time to wait for **dynamic** content to load in **milliseconds**.
343
+
296
344
  extra_headers: Send extra headers
297
345
 
298
346
  extra_query: Add additional query parameters to the request
@@ -307,7 +355,11 @@ class AsyncToolsResource(AsyncAPIResource):
307
355
  body=await async_maybe_transform(
308
356
  {
309
357
  "format": format,
358
+ "new_page": new_page,
359
+ "page_index": page_index,
360
+ "return_partial_on_timeout": return_partial_on_timeout,
310
361
  "url": url,
362
+ "wait": wait,
311
363
  },
312
364
  tool_fetch_webpage_params.ToolFetchWebpageParams,
313
365
  ),
@@ -327,15 +379,19 @@ class AsyncToolsResource(AsyncAPIResource):
327
379
  self,
328
380
  *,
329
381
  prompt: str,
330
- session_id: str | NotGiven = NOT_GIVEN,
331
- output_schema: object | NotGiven = NOT_GIVEN,
332
- url: str | NotGiven = NOT_GIVEN,
382
+ session_id: str | Omit = omit,
383
+ agent: Literal["browser-use", "openai-cua"] | Omit = omit,
384
+ highlight_elements: bool | Omit = omit,
385
+ model: str | Omit = omit,
386
+ output_schema: object | Omit = omit,
387
+ provider: Literal["openai", "gemini", "groq", "azure", "xai"] | Omit = omit,
388
+ url: str | Omit = omit,
333
389
  # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
334
390
  # The extra values given here take precedence over values defined on the client or passed to this method.
335
391
  extra_headers: Headers | None = None,
336
392
  extra_query: Query | None = None,
337
393
  extra_body: Body | None = None,
338
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
394
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
339
395
  ) -> ToolPerformWebTaskResponse:
340
396
  """
341
397
  Start from a URL and perform the given task.
@@ -347,8 +403,18 @@ class AsyncToolsResource(AsyncAPIResource):
347
403
  sessions. When passed, the tool will be executed on the provided browser
348
404
  session.
349
405
 
406
+ agent: The AI agent to use for task completion. Defaults to browser-use.
407
+
408
+ highlight_elements: Whether to highlight elements during task execution for better visibility.
409
+
410
+ model: The specific model to use for task completion. see our
411
+ [models](/agentic-browser-control/ai-task-completion#available-models) page for
412
+ more information.
413
+
350
414
  output_schema: JSON Schema defining the expected structure of the output data.
351
415
 
416
+ provider: The AI provider to use for task completion.
417
+
352
418
  url: The URL of the webpage. If not provided, the tool will use the current page in
353
419
  the session.
354
420
 
@@ -365,7 +431,11 @@ class AsyncToolsResource(AsyncAPIResource):
365
431
  body=await async_maybe_transform(
366
432
  {
367
433
  "prompt": prompt,
434
+ "agent": agent,
435
+ "highlight_elements": highlight_elements,
436
+ "model": model,
368
437
  "output_schema": output_schema,
438
+ "provider": provider,
369
439
  "url": url,
370
440
  },
371
441
  tool_perform_web_task_params.ToolPerformWebTaskParams,
@@ -385,21 +455,21 @@ class AsyncToolsResource(AsyncAPIResource):
385
455
  async def screenshot_webpage(
386
456
  self,
387
457
  *,
388
- session_id: str | NotGiven = NOT_GIVEN,
389
- capture_full_height: bool | NotGiven = NOT_GIVEN,
390
- height: int | NotGiven = NOT_GIVEN,
391
- image_quality: int | NotGiven = NOT_GIVEN,
392
- s3_target_address: str | NotGiven = NOT_GIVEN,
393
- scroll_all_content: bool | NotGiven = NOT_GIVEN,
394
- url: str | NotGiven = NOT_GIVEN,
395
- wait: int | NotGiven = NOT_GIVEN,
396
- width: int | NotGiven = NOT_GIVEN,
458
+ session_id: str | Omit = omit,
459
+ capture_full_height: bool | Omit = omit,
460
+ height: int | Omit = omit,
461
+ image_quality: int | Omit = omit,
462
+ s3_target_address: str | Omit = omit,
463
+ scroll_all_content: bool | Omit = omit,
464
+ url: str | Omit = omit,
465
+ wait: int | Omit = omit,
466
+ width: int | Omit = omit,
397
467
  # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
398
468
  # The extra values given here take precedence over values defined on the client or passed to this method.
399
469
  extra_headers: Headers | None = None,
400
470
  extra_query: Query | None = None,
401
471
  extra_body: Body | None = None,
402
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
472
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
403
473
  ) -> AsyncBinaryAPIResponse:
404
474
  """
405
475
  This endpoint captures a screenshot of the specified webpage using Chromium.
@@ -3,17 +3,23 @@
3
3
  from __future__ import annotations
4
4
 
5
5
  from .shared import SuccessResponse as SuccessResponse
6
+ from .task_list_params import TaskListParams as TaskListParams
6
7
  from .extension_manifest import ExtensionManifest as ExtensionManifest
8
+ from .task_create_params import TaskCreateParams as TaskCreateParams
9
+ from .task_list_response import TaskListResponse as TaskListResponse
10
+ from .event_signal_params import EventSignalParams as EventSignalParams
7
11
  from .session_goto_params import SessionGotoParams as SessionGotoParams
8
12
  from .session_paste_params import SessionPasteParams as SessionPasteParams
13
+ from .task_create_response import TaskCreateResponse as TaskCreateResponse
14
+ from .event_wait_for_params import EventWaitForParams as EventWaitForParams
9
15
  from .profile_create_params import ProfileCreateParams as ProfileCreateParams
10
16
  from .profile_list_response import ProfileListResponse as ProfileListResponse
11
- from .profile_update_params import ProfileUpdateParams as ProfileUpdateParams
12
17
  from .session_copy_response import SessionCopyResponse as SessionCopyResponse
13
18
  from .session_create_params import SessionCreateParams as SessionCreateParams
14
19
  from .session_goto_response import SessionGotoResponse as SessionGotoResponse
15
20
  from .session_scroll_params import SessionScrollParams as SessionScrollParams
16
21
  from .session_paste_response import SessionPasteResponse as SessionPasteResponse
22
+ from .event_wait_for_response import EventWaitForResponse as EventWaitForResponse
17
23
  from .extension_list_response import ExtensionListResponse as ExtensionListResponse
18
24
  from .extension_upload_params import ExtensionUploadParams as ExtensionUploadParams
19
25
  from .session_create_response import SessionCreateResponse as SessionCreateResponse
@@ -21,12 +27,19 @@ from .session_scroll_response import SessionScrollResponse as SessionScrollRespo
21
27
  from .extension_delete_response import ExtensionDeleteResponse as ExtensionDeleteResponse
22
28
  from .extension_upload_response import ExtensionUploadResponse as ExtensionUploadResponse
23
29
  from .profile_retrieve_response import ProfileRetrieveResponse as ProfileRetrieveResponse
30
+ from .session_retrieve_response import SessionRetrieveResponse as SessionRetrieveResponse
24
31
  from .tool_fetch_webpage_params import ToolFetchWebpageParams as ToolFetchWebpageParams
32
+ from .session_upload_file_params import SessionUploadFileParams as SessionUploadFileParams
33
+ from .batch_session_create_params import BatchSessionCreateParams as BatchSessionCreateParams
25
34
  from .extension_retrieve_response import ExtensionRetrieveResponse as ExtensionRetrieveResponse
35
+ from .session_list_pages_response import SessionListPagesResponse as SessionListPagesResponse
26
36
  from .tool_fetch_webpage_response import ToolFetchWebpageResponse as ToolFetchWebpageResponse
27
37
  from .session_drag_and_drop_params import SessionDragAndDropParams as SessionDragAndDropParams
38
+ from .session_upload_file_response import SessionUploadFileResponse as SessionUploadFileResponse
28
39
  from .tool_perform_web_task_params import ToolPerformWebTaskParams as ToolPerformWebTaskParams
40
+ from .batch_session_create_response import BatchSessionCreateResponse as BatchSessionCreateResponse
29
41
  from .session_drag_and_drop_response import SessionDragAndDropResponse as SessionDragAndDropResponse
30
42
  from .tool_perform_web_task_response import ToolPerformWebTaskResponse as ToolPerformWebTaskResponse
31
43
  from .tool_screenshot_webpage_params import ToolScreenshotWebpageParams as ToolScreenshotWebpageParams
44
+ from .batch_session_retrieve_response import BatchSessionRetrieveResponse as BatchSessionRetrieveResponse
32
45
  from .session_retrieve_downloads_response import SessionRetrieveDownloadsResponse as SessionRetrieveDownloadsResponse