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
@@ -0,0 +1,6 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from __future__ import annotations
4
+
5
+ from .run_execute_params import RunExecuteParams as RunExecuteParams
6
+ from .run_execute_response import RunExecuteResponse as RunExecuteResponse
@@ -0,0 +1,324 @@
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, Union
6
+ from typing_extensions import Literal, Required, Annotated, TypeAlias, TypedDict
7
+
8
+ from ..._utils import PropertyInfo
9
+
10
+ __all__ = [
11
+ "RunExecuteParams",
12
+ "OverrideBrowserConfiguration",
13
+ "OverrideBrowserConfigurationLiveView",
14
+ "OverrideBrowserConfigurationProxy",
15
+ "OverrideBrowserConfigurationProxyAnchorProxy",
16
+ "OverrideBrowserConfigurationProxyCustomProxy",
17
+ "OverrideBrowserConfigurationRecording",
18
+ "OverrideBrowserConfigurationTimeout",
19
+ ]
20
+
21
+
22
+ class RunExecuteParams(TypedDict, total=False):
23
+ task_id: Required[Annotated[str, PropertyInfo(alias="taskId")]]
24
+ """Task identifier"""
25
+
26
+ inputs: Dict[str, str]
27
+ """Environment variables for task execution (keys must start with ANCHOR\\__)"""
28
+
29
+ override_browser_configuration: Annotated[
30
+ OverrideBrowserConfiguration, PropertyInfo(alias="overrideBrowserConfiguration")
31
+ ]
32
+ """Override browser configuration for this execution"""
33
+
34
+ session_id: Annotated[str, PropertyInfo(alias="sessionId")]
35
+ """Optional existing session ID to use"""
36
+
37
+ task_session_id: Annotated[str, PropertyInfo(alias="taskSessionId")]
38
+ """Optional task-specific session ID"""
39
+
40
+ version: str
41
+ """Version to run (draft, latest, or version number)"""
42
+
43
+
44
+ class OverrideBrowserConfigurationLiveView(TypedDict, total=False):
45
+ read_only: bool
46
+ """Enable or disable read-only mode for live viewing. Defaults to `false`."""
47
+
48
+
49
+ class OverrideBrowserConfigurationProxyAnchorProxy(TypedDict, total=False):
50
+ active: Required[bool]
51
+
52
+ city: str
53
+ """City name for precise geographic targeting.
54
+
55
+ Supported for anchor_proxy only. Can only be used when region is also provided.
56
+ """
57
+
58
+ country_code: Literal[
59
+ "af",
60
+ "al",
61
+ "dz",
62
+ "ad",
63
+ "ao",
64
+ "as",
65
+ "ag",
66
+ "ar",
67
+ "am",
68
+ "aw",
69
+ "au",
70
+ "at",
71
+ "az",
72
+ "bs",
73
+ "bh",
74
+ "bb",
75
+ "by",
76
+ "be",
77
+ "bz",
78
+ "bj",
79
+ "bm",
80
+ "bo",
81
+ "ba",
82
+ "br",
83
+ "bg",
84
+ "bf",
85
+ "cm",
86
+ "ca",
87
+ "cv",
88
+ "td",
89
+ "cl",
90
+ "co",
91
+ "cg",
92
+ "cr",
93
+ "ci",
94
+ "hr",
95
+ "cu",
96
+ "cy",
97
+ "cz",
98
+ "dk",
99
+ "dm",
100
+ "do",
101
+ "ec",
102
+ "eg",
103
+ "sv",
104
+ "ee",
105
+ "et",
106
+ "fo",
107
+ "fi",
108
+ "fr",
109
+ "gf",
110
+ "pf",
111
+ "ga",
112
+ "gm",
113
+ "ge",
114
+ "de",
115
+ "gh",
116
+ "gi",
117
+ "gr",
118
+ "gd",
119
+ "gp",
120
+ "gt",
121
+ "gg",
122
+ "gn",
123
+ "gw",
124
+ "gy",
125
+ "ht",
126
+ "hn",
127
+ "hu",
128
+ "is",
129
+ "in",
130
+ "ir",
131
+ "iq",
132
+ "ie",
133
+ "il",
134
+ "it",
135
+ "jm",
136
+ "jp",
137
+ "jo",
138
+ "kz",
139
+ "kw",
140
+ "kg",
141
+ "lv",
142
+ "lb",
143
+ "ly",
144
+ "li",
145
+ "lt",
146
+ "lu",
147
+ "mk",
148
+ "ml",
149
+ "mt",
150
+ "mq",
151
+ "mr",
152
+ "mx",
153
+ "md",
154
+ "mc",
155
+ "me",
156
+ "ma",
157
+ "nl",
158
+ "nz",
159
+ "ni",
160
+ "ng",
161
+ "no",
162
+ "pk",
163
+ "pa",
164
+ "py",
165
+ "pe",
166
+ "ph",
167
+ "pl",
168
+ "pt",
169
+ "pr",
170
+ "qa",
171
+ "ro",
172
+ "lc",
173
+ "sm",
174
+ "sa",
175
+ "sn",
176
+ "rs",
177
+ "sc",
178
+ "sl",
179
+ "sk",
180
+ "si",
181
+ "so",
182
+ "za",
183
+ "kr",
184
+ "es",
185
+ "sr",
186
+ "se",
187
+ "ch",
188
+ "sy",
189
+ "st",
190
+ "tw",
191
+ "tj",
192
+ "tg",
193
+ "tt",
194
+ "tn",
195
+ "tr",
196
+ "tc",
197
+ "ua",
198
+ "ae",
199
+ "us",
200
+ "uy",
201
+ "uz",
202
+ "ve",
203
+ "ye",
204
+ "bd",
205
+ "bw",
206
+ "bn",
207
+ "bi",
208
+ "kh",
209
+ "cn",
210
+ "dj",
211
+ "gq",
212
+ "sz",
213
+ "fj",
214
+ "hk",
215
+ "id",
216
+ "ke",
217
+ "la",
218
+ "ls",
219
+ "lr",
220
+ "mg",
221
+ "mw",
222
+ "my",
223
+ "mv",
224
+ "mn",
225
+ "mz",
226
+ "mm",
227
+ "na",
228
+ "np",
229
+ "nc",
230
+ "ne",
231
+ "om",
232
+ "pg",
233
+ "ru",
234
+ "rw",
235
+ "ws",
236
+ "sg",
237
+ "ss",
238
+ "lk",
239
+ "sd",
240
+ "tz",
241
+ "th",
242
+ "tl",
243
+ "tm",
244
+ "ug",
245
+ "gb",
246
+ "vu",
247
+ "vn",
248
+ "zm",
249
+ "zw",
250
+ "bt",
251
+ "mu",
252
+ ]
253
+ """Supported country codes ISO 2 lowercase
254
+
255
+ **On change make sure to update the Proxy type.**
256
+ """
257
+
258
+ region: str
259
+ """
260
+ Region code for more specific geographic targeting. The city parameter can only
261
+ be used when region is also provided.
262
+ """
263
+
264
+ type: Literal["anchor_proxy", "anchor_residential", "anchor_mobile", "anchor_gov"]
265
+ """**On change make sure to update the country_code.**"""
266
+
267
+
268
+ class OverrideBrowserConfigurationProxyCustomProxy(TypedDict, total=False):
269
+ active: Required[bool]
270
+
271
+ password: Required[str]
272
+ """Proxy password"""
273
+
274
+ server: Required[str]
275
+ """Proxy server address"""
276
+
277
+ type: Required[Literal["custom"]]
278
+
279
+ username: Required[str]
280
+ """Proxy username"""
281
+
282
+
283
+ OverrideBrowserConfigurationProxy: TypeAlias = Union[
284
+ OverrideBrowserConfigurationProxyAnchorProxy, OverrideBrowserConfigurationProxyCustomProxy
285
+ ]
286
+
287
+
288
+ class OverrideBrowserConfigurationRecording(TypedDict, total=False):
289
+ active: bool
290
+ """Enable or disable video recording of the browser session. Defaults to `true`."""
291
+
292
+
293
+ class OverrideBrowserConfigurationTimeout(TypedDict, total=False):
294
+ idle_timeout: int
295
+ """
296
+ The amount of time (in minutes) the browser session waits for new connections
297
+ after all others are closed before stopping. Defaults to `5`.
298
+ """
299
+
300
+ max_duration: int
301
+ """Maximum amount of time (in minutes) for the browser to run before terminating.
302
+
303
+ Defaults to `20`.
304
+ """
305
+
306
+
307
+ class OverrideBrowserConfiguration(TypedDict, total=False):
308
+ initial_url: str
309
+ """The URL to navigate to when the browser session starts.
310
+
311
+ If not provided, the browser will load an empty page.
312
+ """
313
+
314
+ live_view: OverrideBrowserConfigurationLiveView
315
+ """Configuration for live viewing the browser session."""
316
+
317
+ proxy: OverrideBrowserConfigurationProxy
318
+ """Proxy Documentation available at [Proxy Documentation](/advanced/proxy)"""
319
+
320
+ recording: OverrideBrowserConfigurationRecording
321
+ """Configuration for session recording."""
322
+
323
+ timeout: OverrideBrowserConfigurationTimeout
324
+ """Timeout configurations for the browser session."""
@@ -0,0 +1,33 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from typing import Optional
4
+
5
+ from pydantic import Field as FieldInfo
6
+
7
+ from ..._models import BaseModel
8
+
9
+ __all__ = ["RunExecuteResponse", "Data"]
10
+
11
+
12
+ class Data(BaseModel):
13
+ message: str
14
+ """Execution result message"""
15
+
16
+ success: bool
17
+ """Whether the task executed successfully"""
18
+
19
+ task_id: str = FieldInfo(alias="taskId")
20
+ """Task identifier"""
21
+
22
+ error: Optional[str] = None
23
+ """Error message if execution failed"""
24
+
25
+ execution_time: Optional[float] = FieldInfo(alias="executionTime", default=None)
26
+ """Execution duration in milliseconds"""
27
+
28
+ output: Optional[str] = None
29
+ """Task execution output"""
30
+
31
+
32
+ class RunExecuteResponse(BaseModel):
33
+ data: Optional[Data] = None
@@ -0,0 +1,317 @@
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 Union
6
+ from typing_extensions import Literal, Required, Annotated, TypeAlias, TypedDict
7
+
8
+ from .._utils import PropertyInfo
9
+
10
+ __all__ = [
11
+ "TaskCreateParams",
12
+ "BrowserConfiguration",
13
+ "BrowserConfigurationLiveView",
14
+ "BrowserConfigurationProxy",
15
+ "BrowserConfigurationProxyAnchorProxy",
16
+ "BrowserConfigurationProxyCustomProxy",
17
+ "BrowserConfigurationRecording",
18
+ "BrowserConfigurationTimeout",
19
+ ]
20
+
21
+
22
+ class TaskCreateParams(TypedDict, total=False):
23
+ language: Required[Literal["typescript"]]
24
+ """Programming language for the task"""
25
+
26
+ name: Required[str]
27
+ """Task name (letters, numbers, hyphens, and underscores only)"""
28
+
29
+ browser_configuration: Annotated[BrowserConfiguration, PropertyInfo(alias="browserConfiguration")]
30
+ """Browser configuration for task execution"""
31
+
32
+ code: str
33
+ """Base64 encoded task code (optional)"""
34
+
35
+ description: str
36
+ """Optional description of the task"""
37
+
38
+
39
+ class BrowserConfigurationLiveView(TypedDict, total=False):
40
+ read_only: bool
41
+ """Enable or disable read-only mode for live viewing. Defaults to `false`."""
42
+
43
+
44
+ class BrowserConfigurationProxyAnchorProxy(TypedDict, total=False):
45
+ active: Required[bool]
46
+
47
+ city: str
48
+ """City name for precise geographic targeting.
49
+
50
+ Supported for anchor_proxy only. Can only be used when region is also provided.
51
+ """
52
+
53
+ country_code: Literal[
54
+ "af",
55
+ "al",
56
+ "dz",
57
+ "ad",
58
+ "ao",
59
+ "as",
60
+ "ag",
61
+ "ar",
62
+ "am",
63
+ "aw",
64
+ "au",
65
+ "at",
66
+ "az",
67
+ "bs",
68
+ "bh",
69
+ "bb",
70
+ "by",
71
+ "be",
72
+ "bz",
73
+ "bj",
74
+ "bm",
75
+ "bo",
76
+ "ba",
77
+ "br",
78
+ "bg",
79
+ "bf",
80
+ "cm",
81
+ "ca",
82
+ "cv",
83
+ "td",
84
+ "cl",
85
+ "co",
86
+ "cg",
87
+ "cr",
88
+ "ci",
89
+ "hr",
90
+ "cu",
91
+ "cy",
92
+ "cz",
93
+ "dk",
94
+ "dm",
95
+ "do",
96
+ "ec",
97
+ "eg",
98
+ "sv",
99
+ "ee",
100
+ "et",
101
+ "fo",
102
+ "fi",
103
+ "fr",
104
+ "gf",
105
+ "pf",
106
+ "ga",
107
+ "gm",
108
+ "ge",
109
+ "de",
110
+ "gh",
111
+ "gi",
112
+ "gr",
113
+ "gd",
114
+ "gp",
115
+ "gt",
116
+ "gg",
117
+ "gn",
118
+ "gw",
119
+ "gy",
120
+ "ht",
121
+ "hn",
122
+ "hu",
123
+ "is",
124
+ "in",
125
+ "ir",
126
+ "iq",
127
+ "ie",
128
+ "il",
129
+ "it",
130
+ "jm",
131
+ "jp",
132
+ "jo",
133
+ "kz",
134
+ "kw",
135
+ "kg",
136
+ "lv",
137
+ "lb",
138
+ "ly",
139
+ "li",
140
+ "lt",
141
+ "lu",
142
+ "mk",
143
+ "ml",
144
+ "mt",
145
+ "mq",
146
+ "mr",
147
+ "mx",
148
+ "md",
149
+ "mc",
150
+ "me",
151
+ "ma",
152
+ "nl",
153
+ "nz",
154
+ "ni",
155
+ "ng",
156
+ "no",
157
+ "pk",
158
+ "pa",
159
+ "py",
160
+ "pe",
161
+ "ph",
162
+ "pl",
163
+ "pt",
164
+ "pr",
165
+ "qa",
166
+ "ro",
167
+ "lc",
168
+ "sm",
169
+ "sa",
170
+ "sn",
171
+ "rs",
172
+ "sc",
173
+ "sl",
174
+ "sk",
175
+ "si",
176
+ "so",
177
+ "za",
178
+ "kr",
179
+ "es",
180
+ "sr",
181
+ "se",
182
+ "ch",
183
+ "sy",
184
+ "st",
185
+ "tw",
186
+ "tj",
187
+ "tg",
188
+ "tt",
189
+ "tn",
190
+ "tr",
191
+ "tc",
192
+ "ua",
193
+ "ae",
194
+ "us",
195
+ "uy",
196
+ "uz",
197
+ "ve",
198
+ "ye",
199
+ "bd",
200
+ "bw",
201
+ "bn",
202
+ "bi",
203
+ "kh",
204
+ "cn",
205
+ "dj",
206
+ "gq",
207
+ "sz",
208
+ "fj",
209
+ "hk",
210
+ "id",
211
+ "ke",
212
+ "la",
213
+ "ls",
214
+ "lr",
215
+ "mg",
216
+ "mw",
217
+ "my",
218
+ "mv",
219
+ "mn",
220
+ "mz",
221
+ "mm",
222
+ "na",
223
+ "np",
224
+ "nc",
225
+ "ne",
226
+ "om",
227
+ "pg",
228
+ "ru",
229
+ "rw",
230
+ "ws",
231
+ "sg",
232
+ "ss",
233
+ "lk",
234
+ "sd",
235
+ "tz",
236
+ "th",
237
+ "tl",
238
+ "tm",
239
+ "ug",
240
+ "gb",
241
+ "vu",
242
+ "vn",
243
+ "zm",
244
+ "zw",
245
+ "bt",
246
+ "mu",
247
+ ]
248
+ """Supported country codes ISO 2 lowercase
249
+
250
+ **On change make sure to update the Proxy type.**
251
+ """
252
+
253
+ region: str
254
+ """
255
+ Region code for more specific geographic targeting. The city parameter can only
256
+ be used when region is also provided.
257
+ """
258
+
259
+ type: Literal["anchor_proxy", "anchor_residential", "anchor_mobile", "anchor_gov"]
260
+ """**On change make sure to update the country_code.**"""
261
+
262
+
263
+ class BrowserConfigurationProxyCustomProxy(TypedDict, total=False):
264
+ active: Required[bool]
265
+
266
+ password: Required[str]
267
+ """Proxy password"""
268
+
269
+ server: Required[str]
270
+ """Proxy server address"""
271
+
272
+ type: Required[Literal["custom"]]
273
+
274
+ username: Required[str]
275
+ """Proxy username"""
276
+
277
+
278
+ BrowserConfigurationProxy: TypeAlias = Union[BrowserConfigurationProxyAnchorProxy, BrowserConfigurationProxyCustomProxy]
279
+
280
+
281
+ class BrowserConfigurationRecording(TypedDict, total=False):
282
+ active: bool
283
+ """Enable or disable video recording of the browser session. Defaults to `true`."""
284
+
285
+
286
+ class BrowserConfigurationTimeout(TypedDict, total=False):
287
+ idle_timeout: int
288
+ """
289
+ The amount of time (in minutes) the browser session waits for new connections
290
+ after all others are closed before stopping. Defaults to `5`.
291
+ """
292
+
293
+ max_duration: int
294
+ """Maximum amount of time (in minutes) for the browser to run before terminating.
295
+
296
+ Defaults to `20`.
297
+ """
298
+
299
+
300
+ class BrowserConfiguration(TypedDict, total=False):
301
+ initial_url: str
302
+ """The URL to navigate to when the browser session starts.
303
+
304
+ If not provided, the browser will load an empty page.
305
+ """
306
+
307
+ live_view: BrowserConfigurationLiveView
308
+ """Configuration for live viewing the browser session."""
309
+
310
+ proxy: BrowserConfigurationProxy
311
+ """Proxy Documentation available at [Proxy Documentation](/advanced/proxy)"""
312
+
313
+ recording: BrowserConfigurationRecording
314
+ """Configuration for session recording."""
315
+
316
+ timeout: BrowserConfigurationTimeout
317
+ """Timeout configurations for the browser session."""