browserless-bap 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 (37) hide show
  1. browserless_bap/__init__.py +35 -0
  2. browserless_bap/_codec.py +29 -0
  3. browserless_bap/_io.py +27 -0
  4. browserless_bap/_page_generated.py +1322 -0
  5. browserless_bap/_unset.py +12 -0
  6. browserless_bap/_version.py +1 -0
  7. browserless_bap/async_api.py +3 -0
  8. browserless_bap/browser.py +108 -0
  9. browserless_bap/browserless.py +30 -0
  10. browserless_bap/element_handle.py +120 -0
  11. browserless_bap/emitter.py +134 -0
  12. browserless_bap/errors.py +64 -0
  13. browserless_bap/graphql/__init__.py +11 -0
  14. browserless_bap/graphql/builder.py +37 -0
  15. browserless_bap/graphql/mutations.py +417 -0
  16. browserless_bap/graphql/subscriptions.py +47 -0
  17. browserless_bap/page.py +771 -0
  18. browserless_bap/py.typed +1 -0
  19. browserless_bap/sync_api/__init__.py +24 -0
  20. browserless_bap/sync_api/_base.py +32 -0
  21. browserless_bap/sync_api/_bridge.py +419 -0
  22. browserless_bap/sync_api/_page_generated.py +979 -0
  23. browserless_bap/sync_api/browser.py +48 -0
  24. browserless_bap/sync_api/browserless.py +33 -0
  25. browserless_bap/sync_api/element_handle.py +70 -0
  26. browserless_bap/sync_api/page.py +383 -0
  27. browserless_bap/transport.py +522 -0
  28. browserless_bap/types/__init__.py +7 -0
  29. browserless_bap/types/enums.py +717 -0
  30. browserless_bap/types/events.py +121 -0
  31. browserless_bap/types/inputs.py +71 -0
  32. browserless_bap/types/options.py +367 -0
  33. browserless_bap/types/responses.py +314 -0
  34. browserless_bap-0.2.0.dist-info/METADATA +264 -0
  35. browserless_bap-0.2.0.dist-info/RECORD +37 -0
  36. browserless_bap-0.2.0.dist-info/WHEEL +4 -0
  37. browserless_bap-0.2.0.dist-info/licenses/LICENSE +21 -0
@@ -0,0 +1,417 @@
1
+ # Generated by scripts/codegen.py from mutations.graphql -- do not edit.
2
+ from __future__ import annotations
3
+
4
+ # fmt: off
5
+ RESPONSE_FIELDS: dict[str, str] = {
6
+ "AddScriptTagResponse": "time",
7
+ "AddStyleTagResponse": "time",
8
+ "Attribute": "name value",
9
+ "CaptchaResponse": "found solved time token error",
10
+ "ClickResponse": "selector time x y",
11
+ "CloseLiveURLResponse": "liveURLId",
12
+ "ConsoleMessage": "type text args location { url lineNumber columnNumber } timestamp",
13
+ "ConsoleMessageLocation": "url lineNumber columnNumber",
14
+ "CookieResponse": "cookies { domain expires httpOnly name path sameSite secure value url } time",
15
+ "DefaultResponse": "timeout",
16
+ "EmulateMediaTypeResponse": "type time",
17
+ "EvaluateResponse": "time value",
18
+ "FulfillResponse": "time",
19
+ "HTMLResponse": "html time",
20
+ "HTTPHeaders": "name value",
21
+ "HTTPHeadersResponse": "headers { name value } time",
22
+ "HTTPResponse": "status time text url",
23
+ "HTTPResponseWithRemoteMetadata": "ip port status time text url",
24
+ "HoverResponse": "selector time x y",
25
+ "JavaScriptResponse": "enabled time",
26
+ "LiveURLCompleteEvent": "liveURLId reason",
27
+ "LiveURLResponse": "liveURLId liveURL timeout",
28
+ "LoadSecretResponse": "ok error message time",
29
+ "MapSelectorResponse": "innerHTML innerText id class",
30
+ "MarkdownResponse": "markdown time",
31
+ "PDFResponse": "base64 size time",
32
+ "ProxyResponse": "time",
33
+ "QuerySelectorResponse": "childElementCount className id innerHTML innerText localName outerHTML",
34
+ "ReconnectionResponse": "browserQLEndpoint browserWSEndpoint devtoolsFrontendUrl webSocketDebuggerUrl",
35
+ "RejectResponse": "time enabled",
36
+ "RequestHeader": "name value",
37
+ "RequestResponse": "url method type headers { name value }",
38
+ "ResponseResponse": "status url method type headers { name value } body",
39
+ "ResponseResponseWithBodyEncoding": "status url method type headers { name value } body base64Encoded",
40
+ "ScreenshotResponse": "base64 format time",
41
+ "ScrollResponse": "selector time x y",
42
+ "SelectResponse": "selector time value",
43
+ "StandardCookie": "domain expires httpOnly name path sameSite secure value url",
44
+ "StopSessionRecordingResponse": "success error",
45
+ "SwitchWindowResponse": "success error title url navigation { status time text url }",
46
+ "TextResponse": "text time",
47
+ "TitleResponse": "title",
48
+ "TypeResponse": "selector text time x y",
49
+ "URLResponse": "url",
50
+ "UserAgentResponse": "userAgent time",
51
+ "ViewportResponse": "width height deviceScaleFactor mobile hasTouch landscape time",
52
+ "WaitForEvent": "time",
53
+ "WaitForFunction": "time",
54
+ "WaitForRequestResponse": "time url",
55
+ "WaitForResponseResponse": "time status url",
56
+ "WaitForSelectorResponse": "height selector time y x width",
57
+ "WaitForTimeoutResponse": "time"
58
+ }
59
+
60
+ ARG_TYPES: dict[str, dict[str, str]] = {
61
+ "addScriptTag": {
62
+ "content": "String",
63
+ "id": "String",
64
+ "type": "String",
65
+ "url": "String"
66
+ },
67
+ "addStyleTag": {
68
+ "content": "String",
69
+ "url": "String"
70
+ },
71
+ "authenticate": {
72
+ "origin": "String",
73
+ "password": "String!",
74
+ "username": "String!"
75
+ },
76
+ "back": {
77
+ "timeout": "Float",
78
+ "waitUntil": "WaitUntilHistory"
79
+ },
80
+ "checkbox": {
81
+ "checked": "Boolean!",
82
+ "scroll": "Boolean",
83
+ "selector": "String!",
84
+ "timeout": "Float",
85
+ "visible": "Boolean",
86
+ "wait": "Boolean"
87
+ },
88
+ "click": {
89
+ "scroll": "Boolean",
90
+ "selector": "String!",
91
+ "timeout": "Float",
92
+ "visible": "Boolean",
93
+ "wait": "Boolean"
94
+ },
95
+ "closeLiveURL": {
96
+ "liveURLId": "String!"
97
+ },
98
+ "content": {
99
+ "html": "String!",
100
+ "timeout": "Float",
101
+ "waitUntil": "WaitUntilHistory",
102
+ "waitUntilAll": "[WaitUntilHistory!]"
103
+ },
104
+ "cookies": {
105
+ "cookies": "[CookieInput]"
106
+ },
107
+ "emulateMediaType": {
108
+ "type": "MediaType!"
109
+ },
110
+ "evaluate": {
111
+ "content": "String",
112
+ "timeout": "Float",
113
+ "url": "String"
114
+ },
115
+ "forward": {
116
+ "timeout": "Float",
117
+ "waitUntil": "WaitUntilHistory"
118
+ },
119
+ "fulfill": {
120
+ "base64Body": "String",
121
+ "body": "String",
122
+ "contentType": "String",
123
+ "headers": "[HeaderInput]",
124
+ "method": "[Method]",
125
+ "operator": "OperatorTypes",
126
+ "regex": "[String]",
127
+ "status": "Int",
128
+ "type": "[ResourceType]",
129
+ "url": "[String]"
130
+ },
131
+ "goto": {
132
+ "referer": "String",
133
+ "referrerPolicy": "String",
134
+ "timeout": "Float",
135
+ "url": "String!",
136
+ "waitUntil": "WaitUntilGoto",
137
+ "waitUntilAll": "[WaitUntilGoto!]"
138
+ },
139
+ "hover": {
140
+ "scroll": "Boolean",
141
+ "selector": "String",
142
+ "timeout": "Float",
143
+ "visible": "Boolean",
144
+ "wait": "Boolean",
145
+ "x": "Float",
146
+ "y": "Float"
147
+ },
148
+ "html": {
149
+ "clean": "CleanInput",
150
+ "rewrite": "HTMLRewriteInput",
151
+ "selector": "String",
152
+ "timeout": "Float",
153
+ "visible": "Boolean"
154
+ },
155
+ "if": {
156
+ "operator": "OperatorTypes",
157
+ "request": "RequestInput",
158
+ "response": "ResponseInput",
159
+ "selector": "String",
160
+ "visible": "Boolean"
161
+ },
162
+ "ifnot": {
163
+ "operator": "OperatorTypes",
164
+ "request": "RequestInput",
165
+ "response": "ResponseInput",
166
+ "selector": "String"
167
+ },
168
+ "javaScriptEnabled": {
169
+ "enabled": "Boolean"
170
+ },
171
+ "liveURL": {
172
+ "captureScale": "Int",
173
+ "compressed": "Boolean",
174
+ "currentStep": "Int",
175
+ "doneLabel": "String",
176
+ "emulateComponents": "Boolean",
177
+ "failLabel": "String",
178
+ "instructions": "StringOrInstructions",
179
+ "instructionsFormat": "InstructionsFormat",
180
+ "instructionsLayout": "InstructionsLayout",
181
+ "instructionsTitle": "String",
182
+ "interactable": "Boolean",
183
+ "quality": "Int",
184
+ "requesterName": "String",
185
+ "resizable": "Boolean",
186
+ "showBrowserInterface": "Boolean",
187
+ "steps": "[String!]",
188
+ "timeout": "Float",
189
+ "type": "LiveURLStreamType"
190
+ },
191
+ "loadSecret": {
192
+ "ref": "String!",
193
+ "selector": "String"
194
+ },
195
+ "mapSelector": {
196
+ "selector": "String!",
197
+ "timeout": "Float",
198
+ "wait": "Boolean"
199
+ },
200
+ "markdown": {
201
+ "selector": "String",
202
+ "timeout": "Float",
203
+ "visible": "Boolean"
204
+ },
205
+ "pdf": {
206
+ "displayHeaderFooter": "Boolean",
207
+ "footerTemplate": "String",
208
+ "format": "PDFPageFormat",
209
+ "fullPage": "Boolean",
210
+ "generateDocumentOutline": "Boolean",
211
+ "generateTaggedPDF": "Boolean",
212
+ "headerTemplate": "String",
213
+ "height": "FloatOrString",
214
+ "landscape": "Boolean",
215
+ "marginBottom": "FloatOrString",
216
+ "marginLeft": "FloatOrString",
217
+ "marginRight": "FloatOrString",
218
+ "marginTop": "FloatOrString",
219
+ "omitBackground": "Boolean",
220
+ "pageRanges": "String",
221
+ "preferCSSPageSize": "Boolean",
222
+ "printBackground": "Boolean",
223
+ "scale": "Float",
224
+ "timeout": "Float",
225
+ "transferMode": "String",
226
+ "waitForFonts": "Boolean",
227
+ "waitForImages": "Boolean",
228
+ "width": "FloatOrString"
229
+ },
230
+ "preferences": {
231
+ "timeout": "Float"
232
+ },
233
+ "proxy": {
234
+ "city": "String",
235
+ "country": "CountryType",
236
+ "method": "[Method]",
237
+ "network": "ProxyNetwork",
238
+ "operator": "OperatorTypes",
239
+ "preset": "String",
240
+ "server": "String",
241
+ "state": "String",
242
+ "sticky": "Boolean",
243
+ "type": "[ResourceType]",
244
+ "url": "[String]"
245
+ },
246
+ "querySelector": {
247
+ "selector": "String!",
248
+ "timeout": "Float",
249
+ "visible": "Boolean"
250
+ },
251
+ "querySelectorAll": {
252
+ "selector": "String!",
253
+ "timeout": "Float",
254
+ "visible": "Boolean"
255
+ },
256
+ "reconnect": {
257
+ "timeout": "Float"
258
+ },
259
+ "reject": {
260
+ "enabled": "Boolean",
261
+ "method": "[Method]",
262
+ "operator": "OperatorTypes",
263
+ "regex": "[String]",
264
+ "type": "[ResourceType]",
265
+ "url": "[String]"
266
+ },
267
+ "reload": {
268
+ "timeout": "Float",
269
+ "waitUntil": "WaitUntilHistory"
270
+ },
271
+ "request": {
272
+ "method": "[Method]",
273
+ "operator": "OperatorTypes",
274
+ "timeout": "Float",
275
+ "type": "[ResourceType]",
276
+ "url": "[String]",
277
+ "wait": "Boolean"
278
+ },
279
+ "response": {
280
+ "method": "[Method]",
281
+ "operator": "OperatorTypes",
282
+ "status": "[Int]",
283
+ "timeout": "Float",
284
+ "type": "[ResourceType]",
285
+ "url": "[String]",
286
+ "wait": "Boolean"
287
+ },
288
+ "screenshot": {
289
+ "captureBeyondViewport": "Boolean",
290
+ "clip": "ScreenshotClip",
291
+ "fromSurface": "Boolean",
292
+ "fullPage": "Boolean",
293
+ "omitBackground": "Boolean",
294
+ "optimizeForSpeed": "Boolean",
295
+ "quality": "Float",
296
+ "selector": "String",
297
+ "timeout": "Float",
298
+ "type": "ScreenshotType",
299
+ "waitForImages": "Boolean"
300
+ },
301
+ "scroll": {
302
+ "selector": "String",
303
+ "throughPage": "Boolean",
304
+ "timeout": "Float",
305
+ "visible": "Boolean",
306
+ "wait": "Boolean",
307
+ "x": "Float",
308
+ "y": "Float"
309
+ },
310
+ "select": {
311
+ "scroll": "Boolean",
312
+ "selector": "String!",
313
+ "timeout": "Float",
314
+ "value": "StringOrArray!",
315
+ "visible": "Boolean",
316
+ "wait": "Boolean"
317
+ },
318
+ "setExtraHTTPHeaders": {
319
+ "headers": "[HeaderInput]"
320
+ },
321
+ "solve": {
322
+ "timeout": "Float",
323
+ "type": "CaptchaTypes",
324
+ "wait": "Boolean"
325
+ },
326
+ "solveImageCaptcha": {
327
+ "captchaSelector": "String!",
328
+ "inputSelector": "String!",
329
+ "timeout": "Float"
330
+ },
331
+ "stopSessionRecording": {},
332
+ "switchToWindow": {
333
+ "newest": "Boolean",
334
+ "timeout": "Float",
335
+ "title": "String",
336
+ "url": "String",
337
+ "waitUntil": "WaitUntilGoto"
338
+ },
339
+ "text": {
340
+ "clean": "CleanInput",
341
+ "selector": "String",
342
+ "timeout": "Float",
343
+ "visible": "Boolean"
344
+ },
345
+ "title": {},
346
+ "type": {
347
+ "delay": "[Int]",
348
+ "interactable": "Boolean",
349
+ "scroll": "Boolean",
350
+ "selector": "String!",
351
+ "text": "String!",
352
+ "timeout": "Float",
353
+ "visible": "Boolean",
354
+ "wait": "Boolean"
355
+ },
356
+ "url": {},
357
+ "userAgent": {
358
+ "userAgent": "String!"
359
+ },
360
+ "verify": {
361
+ "timeout": "Float",
362
+ "type": "VerifyTypes!",
363
+ "wait": "Boolean"
364
+ },
365
+ "viewport": {
366
+ "deviceScaleFactor": "Float",
367
+ "hasTouch": "Boolean",
368
+ "height": "Float!",
369
+ "landscape": "Boolean",
370
+ "mobile": "Boolean",
371
+ "width": "Float!"
372
+ },
373
+ "waitForEvent": {
374
+ "event": "String!",
375
+ "timeout": "Float"
376
+ },
377
+ "waitForFunction": {
378
+ "fn": "String!",
379
+ "polling": "Float",
380
+ "pollingType": "WaitForFunctionPolling",
381
+ "timeout": "Float"
382
+ },
383
+ "waitForNavigation": {
384
+ "timeout": "Float",
385
+ "waitUntil": "WaitUntilGoto"
386
+ },
387
+ "waitForNetworkIdle": {
388
+ "concurrency": "Int",
389
+ "idleTime": "Float",
390
+ "timeout": "Float"
391
+ },
392
+ "waitForRequest": {
393
+ "method": "Method",
394
+ "operator": "OperatorTypes",
395
+ "timeout": "Float",
396
+ "url": "String"
397
+ },
398
+ "waitForResponse": {
399
+ "codes": "[Int]",
400
+ "operator": "OperatorTypes",
401
+ "statuses": "[Int]",
402
+ "url": "String"
403
+ },
404
+ "waitForSelector": {
405
+ "hidden": "Boolean",
406
+ "selector": "String!",
407
+ "timeout": "Float",
408
+ "visible": "Boolean"
409
+ },
410
+ "waitForTimeout": {
411
+ "time": "Float!"
412
+ },
413
+ "watchEvent": {
414
+ "event": "String!"
415
+ }
416
+ }
417
+ # fmt: on
@@ -0,0 +1,47 @@
1
+ # Generated by scripts/codegen.py from mutations.graphql -- do not edit.
2
+ from __future__ import annotations
3
+
4
+ from typing import TypedDict
5
+
6
+
7
+ class SubscriptionSpec(TypedDict):
8
+ response_type: str
9
+ fields: str
10
+ arg_types: dict[str, str]
11
+
12
+
13
+ # fmt: off
14
+ SUBSCRIPTIONS: dict[str, SubscriptionSpec] = {
15
+ "console": {
16
+ "arg_types": {},
17
+ "fields": "type text args location { url lineNumber columnNumber } timestamp",
18
+ "response_type": "ConsoleMessage"
19
+ },
20
+ "liveComplete": {
21
+ "arg_types": {},
22
+ "fields": "liveURLId reason",
23
+ "response_type": "LiveURLCompleteEvent"
24
+ },
25
+ "request": {
26
+ "arg_types": {
27
+ "method": "[Method]",
28
+ "operator": "OperatorTypes",
29
+ "type": "[ResourceType]",
30
+ "url": "[String]"
31
+ },
32
+ "fields": "url method type headers { name value }",
33
+ "response_type": "RequestResponse"
34
+ },
35
+ "response": {
36
+ "arg_types": {
37
+ "method": "[Method]",
38
+ "operator": "OperatorTypes",
39
+ "status": "[Int]",
40
+ "type": "[ResourceType]",
41
+ "url": "[String]"
42
+ },
43
+ "fields": "status url method type headers { name value }",
44
+ "response_type": "ResponseResponse"
45
+ }
46
+ }
47
+ # fmt: on