Skip to content

Commit ab1093d

Browse files
mehaaseBrian Mackintosh
andcommitted
Simplified API
This commit contains the generated code. Co-authored-by: Brian Mackintosh <bckmackintosh@gmail.com>
1 parent 06948e9 commit ab1093d

45 files changed

Lines changed: 7225 additions & 0 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

trio_cdp/generated/__init__.py

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# DO NOT EDIT THIS FILE!
2+
#
3+
# This code is generated off of PyCDP modules. If you need to make
4+
# changes, edit the generator and regenerate all of the modules.
5+
6+
from . import accessibility
7+
from . import animation
8+
from . import application_cache
9+
from . import audits
10+
from . import background_service
11+
from . import browser
12+
from . import cache_storage
13+
from . import cast
14+
from . import console
15+
from . import css
16+
from . import database
17+
from . import debugger
18+
from . import device_orientation
19+
from . import dom
20+
from . import dom_debugger
21+
from . import dom_snapshot
22+
from . import dom_storage
23+
from . import emulation
24+
from . import fetch
25+
from . import headless_experimental
26+
from . import heap_profiler
27+
from . import indexed_db
28+
from . import input
29+
from . import inspector
30+
from . import io
31+
from . import layer_tree
32+
from . import log
33+
from . import memory
34+
from . import network
35+
from . import overlay
36+
from . import page
37+
from . import performance
38+
from . import profiler
39+
from . import runtime
40+
from . import schema
41+
from . import security
42+
from . import service_worker
43+
from . import storage
44+
from . import system_info
45+
from . import target
46+
from . import tethering
47+
from . import tracing
48+
from . import web_audio
49+
from . import web_authn
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# DO NOT EDIT THIS FILE!
2+
#
3+
# This code is generated off of PyCDP modules. If you need to make
4+
# changes, edit the generator and regenerate all of the modules.
5+
6+
from __future__ import annotations
7+
import typing
8+
9+
from ..context import get_connection_context, get_session_context
10+
11+
import cdp.accessibility
12+
from cdp.accessibility import (
13+
AXNode,
14+
AXNodeId,
15+
AXProperty,
16+
AXPropertyName,
17+
AXRelatedNode,
18+
AXValue,
19+
AXValueNativeSourceType,
20+
AXValueSource,
21+
AXValueSourceType,
22+
AXValueType
23+
)
24+
25+
26+
async def disable() -> None:
27+
'''
28+
Disables the accessibility domain.
29+
'''
30+
session = get_session_context('accessibility.disable')
31+
return await session.execute(cdp.accessibility.disable())
32+
33+
34+
async def enable() -> None:
35+
'''
36+
Enables the accessibility domain which causes `AXNodeId`s to remain consistent between method calls.
37+
This turns on accessibility for the page, which can impact performance until accessibility is disabled.
38+
'''
39+
session = get_session_context('accessibility.enable')
40+
return await session.execute(cdp.accessibility.enable())
41+
42+
43+
async def get_full_ax_tree() -> typing.List[AXNode]:
44+
'''
45+
Fetches the entire accessibility tree
46+
47+
:returns:
48+
'''
49+
session = get_session_context('accessibility.get_full_ax_tree')
50+
return await session.execute(cdp.accessibility.get_full_ax_tree())
51+
52+
53+
async def get_partial_ax_tree(
54+
node_id: typing.Optional[dom.NodeId] = None,
55+
backend_node_id: typing.Optional[dom.BackendNodeId] = None,
56+
object_id: typing.Optional[runtime.RemoteObjectId] = None,
57+
fetch_relatives: typing.Optional[bool] = None
58+
) -> typing.List[AXNode]:
59+
'''
60+
Fetches the accessibility node and partial accessibility tree for this DOM node, if it exists.
61+
62+
:param node_id: Identifier of the node to get the partial accessibility tree for.
63+
:param backend_node_id: Identifier of the backend node to get the partial accessibility tree for.
64+
:param object_id: JavaScript object id of the node wrapper to get the partial accessibility tree for.
65+
:param fetch_relatives: Whether to fetch this nodes ancestors, siblings and children. Defaults to true.
66+
:returns: The ``Accessibility.AXNode`` for this DOM node, if it exists, plus its ancestors, siblings and
67+
children, if requested.
68+
'''
69+
session = get_session_context('accessibility.get_partial_ax_tree')
70+
return await session.execute(cdp.accessibility.get_partial_ax_tree(node_id, backend_node_id, object_id, fetch_relatives))

trio_cdp/generated/animation.py

Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
# DO NOT EDIT THIS FILE!
2+
#
3+
# This code is generated off of PyCDP modules. If you need to make
4+
# changes, edit the generator and regenerate all of the modules.
5+
6+
from __future__ import annotations
7+
import typing
8+
9+
from ..context import get_connection_context, get_session_context
10+
11+
import cdp.animation
12+
from cdp.animation import (
13+
Animation,
14+
AnimationCanceled,
15+
AnimationCreated,
16+
AnimationEffect,
17+
AnimationStarted,
18+
KeyframeStyle,
19+
KeyframesRule
20+
)
21+
22+
23+
async def disable() -> None:
24+
'''
25+
Disables animation domain notifications.
26+
'''
27+
session = get_session_context('animation.disable')
28+
return await session.execute(cdp.animation.disable())
29+
30+
31+
async def enable() -> None:
32+
'''
33+
Enables animation domain notifications.
34+
'''
35+
session = get_session_context('animation.enable')
36+
return await session.execute(cdp.animation.enable())
37+
38+
39+
async def get_current_time(
40+
id: str
41+
) -> float:
42+
'''
43+
Returns the current time of the an animation.
44+
45+
:param id: Id of animation.
46+
:returns: Current time of the page.
47+
'''
48+
session = get_session_context('animation.get_current_time')
49+
return await session.execute(cdp.animation.get_current_time(id))
50+
51+
52+
async def get_playback_rate() -> float:
53+
'''
54+
Gets the playback rate of the document timeline.
55+
56+
:returns: Playback rate for animations on page.
57+
'''
58+
session = get_session_context('animation.get_playback_rate')
59+
return await session.execute(cdp.animation.get_playback_rate())
60+
61+
62+
async def release_animations(
63+
animations: typing.List[str]
64+
) -> None:
65+
'''
66+
Releases a set of animations to no longer be manipulated.
67+
68+
:param animations: List of animation ids to seek.
69+
'''
70+
session = get_session_context('animation.release_animations')
71+
return await session.execute(cdp.animation.release_animations(animations))
72+
73+
74+
async def resolve_animation(
75+
animation_id: str
76+
) -> runtime.RemoteObject:
77+
'''
78+
Gets the remote object of the Animation.
79+
80+
:param animation_id: Animation id.
81+
:returns: Corresponding remote object.
82+
'''
83+
session = get_session_context('animation.resolve_animation')
84+
return await session.execute(cdp.animation.resolve_animation(animation_id))
85+
86+
87+
async def seek_animations(
88+
animations: typing.List[str],
89+
current_time: float
90+
) -> None:
91+
'''
92+
Seek a set of animations to a particular time within each animation.
93+
94+
:param animations: List of animation ids to seek.
95+
:param current_time: Set the current time of each animation.
96+
'''
97+
session = get_session_context('animation.seek_animations')
98+
return await session.execute(cdp.animation.seek_animations(animations, current_time))
99+
100+
101+
async def set_paused(
102+
animations: typing.List[str],
103+
paused: bool
104+
) -> None:
105+
'''
106+
Sets the paused state of a set of animations.
107+
108+
:param animations: Animations to set the pause state of.
109+
:param paused: Paused state to set to.
110+
'''
111+
session = get_session_context('animation.set_paused')
112+
return await session.execute(cdp.animation.set_paused(animations, paused))
113+
114+
115+
async def set_playback_rate(
116+
playback_rate: float
117+
) -> None:
118+
'''
119+
Sets the playback rate of the document timeline.
120+
121+
:param playback_rate: Playback rate for animations on page
122+
'''
123+
session = get_session_context('animation.set_playback_rate')
124+
return await session.execute(cdp.animation.set_playback_rate(playback_rate))
125+
126+
127+
async def set_timing(
128+
animation_id: str,
129+
duration: float,
130+
delay: float
131+
) -> None:
132+
'''
133+
Sets the timing of an animation node.
134+
135+
:param animation_id: Animation id.
136+
:param duration: Duration of the animation.
137+
:param delay: Delay of the animation.
138+
'''
139+
session = get_session_context('animation.set_timing')
140+
return await session.execute(cdp.animation.set_timing(animation_id, duration, delay))
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# DO NOT EDIT THIS FILE!
2+
#
3+
# This code is generated off of PyCDP modules. If you need to make
4+
# changes, edit the generator and regenerate all of the modules.
5+
6+
from __future__ import annotations
7+
import typing
8+
9+
from ..context import get_connection_context, get_session_context
10+
11+
import cdp.application_cache
12+
from cdp.application_cache import (
13+
ApplicationCache,
14+
ApplicationCacheResource,
15+
ApplicationCacheStatusUpdated,
16+
FrameWithManifest,
17+
NetworkStateUpdated
18+
)
19+
20+
21+
async def enable() -> None:
22+
'''
23+
Enables application cache domain notifications.
24+
'''
25+
session = get_session_context('application_cache.enable')
26+
return await session.execute(cdp.application_cache.enable())
27+
28+
29+
async def get_application_cache_for_frame(
30+
frame_id: page.FrameId
31+
) -> ApplicationCache:
32+
'''
33+
Returns relevant application cache data for the document in given frame.
34+
35+
:param frame_id: Identifier of the frame containing document whose application cache is retrieved.
36+
:returns: Relevant application cache data for the document in given frame.
37+
'''
38+
session = get_session_context('application_cache.get_application_cache_for_frame')
39+
return await session.execute(cdp.application_cache.get_application_cache_for_frame(frame_id))
40+
41+
42+
async def get_frames_with_manifests() -> typing.List[FrameWithManifest]:
43+
'''
44+
Returns array of frame identifiers with manifest urls for each frame containing a document
45+
associated with some application cache.
46+
47+
:returns: Array of frame identifiers with manifest urls for each frame containing a document
48+
associated with some application cache.
49+
'''
50+
session = get_session_context('application_cache.get_frames_with_manifests')
51+
return await session.execute(cdp.application_cache.get_frames_with_manifests())
52+
53+
54+
async def get_manifest_for_frame(
55+
frame_id: page.FrameId
56+
) -> str:
57+
'''
58+
Returns manifest URL for document in the given frame.
59+
60+
:param frame_id: Identifier of the frame containing document whose manifest is retrieved.
61+
:returns: Manifest URL for document in the given frame.
62+
'''
63+
session = get_session_context('application_cache.get_manifest_for_frame')
64+
return await session.execute(cdp.application_cache.get_manifest_for_frame(frame_id))

trio_cdp/generated/audits.py

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# DO NOT EDIT THIS FILE!
2+
#
3+
# This code is generated off of PyCDP modules. If you need to make
4+
# changes, edit the generator and regenerate all of the modules.
5+
6+
from __future__ import annotations
7+
import typing
8+
9+
from ..context import get_connection_context, get_session_context
10+
11+
import cdp.audits
12+
13+
async def get_encoded_response(
14+
request_id: network.RequestId,
15+
encoding: str,
16+
quality: typing.Optional[float] = None,
17+
size_only: typing.Optional[bool] = None
18+
) -> typing.Tuple[typing.Optional[str], int, int]:
19+
'''
20+
Returns the response body and size if it were re-encoded with the specified settings. Only
21+
applies to images.
22+
23+
:param request_id: Identifier of the network request to get content for.
24+
:param encoding: The encoding to use.
25+
:param quality: The quality of the encoding (0-1). (defaults to 1)
26+
:param size_only: Whether to only return the size information (defaults to false).
27+
:returns: a tuple with the following items:
28+
0. body: (Optional) The encoded body as a base64 string. Omitted if sizeOnly is true.
29+
1. originalSize: Size before re-encoding.
30+
2. encodedSize: Size after re-encoding.
31+
'''
32+
session = get_session_context('audits.get_encoded_response')
33+
return await session.execute(cdp.audits.get_encoded_response(request_id, encoding, quality, size_only))

0 commit comments

Comments
 (0)