Skip to content

Commit 45eea89

Browse files
committed
Update docs
* Reorganize sphinx docs a bit. * Add some badges. * Add an MIT license.
1 parent 460bf04 commit 45eea89

5 files changed

Lines changed: 77 additions & 35 deletions

File tree

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2018 Hyperion Gray
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in
13+
all copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21+
THE SOFTWARE.

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# PyCDP
22

3+
[![PyPI](https://img.shields.io/pypi/v/chrome-devtools-protocol.svg)](https://pypi.org/project/chrome-devtools-protocol/)
4+
![Python Versions](https://img.shields.io/pypi/pyversions/chrome-devtools-protocol)
5+
![MIT License](https://img.shields.io/github/license/HyperionGray/python-chrome-devtools-protocol.svg)
6+
[![Build Status](https://img.shields.io/travis/com/HyperionGray/python-chrome-devtools-protocol.svg?branch=master)](https://travis-ci.com/HyperionGray/python-chrome-devtools-protocol)
7+
[![Read the Docs](https://img.shields.io/readthedocs/py-cdp.svg)](https://py-cdp.readthedocs.io)
8+
39
Python Chrome DevTools Protocol (shortened to PyCDP) is a library that provides
410
Python wrappers for the types, commands, and events specified in the [Chrome
511
DevTools Protocol](https://github.com/ChromeDevTools/devtools-protocol/).

docs/getting_started.rst

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
Overview
2-
========
1+
Getting Started
2+
===============
33

44
The best way to understand how to use PyCDP is to look at how it converts the
55
machine-readable Chrome DevTools Protocol (CDP) spec into Python code. Once you
@@ -15,17 +15,13 @@ and snake casing module/function/variable names.
1515
Within each domain, CDP specifies three things. Note that CDP types can be
1616
further divided into three categories.
1717

18-
1. Types
19-
20-
a. Primitive Types
21-
b. Enumerations
22-
c. Class Types
23-
18+
1. Types: Primitives, Enumerations, & Classes
2419
2. Commands
2520
3. Events
2621

27-
This overview will show examples of the CDP specification for each of these
28-
things, and then explain how that specification is used to generate Python code.
22+
This section shows examples of the CDP specification for each of these
23+
things, and then explains how that specification is used to generate Python
24+
code.
2925

3026

3127
Primitive Types
@@ -76,8 +72,8 @@ Instead, you'll receive a primitive type (such as script identifier) from one
7672
API call and then you'll send it back as an argument to a later API call.
7773

7874

79-
Enumerations
80-
------------
75+
Enumeration Types
76+
-----------------
8177

8278
CDP specifies enumerations to provide named constants. Enumeration values are
8379
always strings.

docs/index.rst

Lines changed: 3 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -3,36 +3,16 @@
33
PyCDP
44
=====
55

6+
[![PyPI](https://img.shields.io/pypi/v/chrome-devtools-protocol.svg?style=flat-square)](https://pypi.org/project/chrome-devtools-protocol/)
7+
68
.. toctree::
79
:caption: Contents
810

11+
overview
912
getting_started
1013
api
1114
develop
1215

13-
Python Chrome DevTools Protocol (shortened to PyCDP) is a library that provides
14-
Python wrappers for the types, commands, and events specified in the `Chrome
15-
DevTools Protocol <https://github.com/ChromeDevTools/devtools-protocol/>`_.
16-
17-
The Chrome DevTools Protocol provides for remote control of a web browser by
18-
sending JSON messages over a WebSocket. That JSON format is described by a
19-
machine-readable specification. This specification is used to automatically
20-
generate the classes and methods found in this library.
21-
22-
You could write a CDP client by connecting a WebSocket and then sending JSON
23-
objects, but this would be tedious and error-prone: the Python interpreter would
24-
not catch any typos in your JSON objects, and you wouldn't get autocomplete for
25-
any parts of the JSON data structure. By providing a set of native Python
26-
wrappers, this project makes it easier and faster to write CDP client code.
27-
28-
**This library does not perform any I/O!** In order to maximize
29-
flexibility, this library does not actually handle any network I/O, such as
30-
opening a socket or negotiating a WebSocket protocol. Instead, that
31-
responsibility is left to higher-level libraries, for example
32-
`trio-chrome-devtools-protocol
33-
<https://github.com/hyperiongray/trio-chrome-devtools-protocol>`_.
34-
35-
3616
Indices and tables
3717
==================
3818

docs/overview.rst

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
Overview
2+
========
3+
4+
Python Chrome DevTools Protocol (shortened to PyCDP) is a library that provides
5+
Python wrappers for the types, commands, and events specified in the `Chrome
6+
DevTools Protocol <https://github.com/ChromeDevTools/devtools-protocol/>`_.
7+
8+
The Chrome DevTools Protocol provides for remote control of a web browser by
9+
sending JSON messages over a WebSocket. That JSON format is described by a
10+
machine-readable specification. This specification is used to automatically
11+
generate the classes and methods found in this library.
12+
13+
You could write a CDP client by connecting a WebSocket and then sending JSON
14+
objects, but this would be tedious and error-prone: the Python interpreter would
15+
not catch any typos in your JSON objects, and you wouldn't get autocomplete for
16+
any parts of the JSON data structure. By providing a set of native Python
17+
wrappers, this project makes it easier and faster to write CDP client code.
18+
19+
**This library does not perform any I/O!** In order to maximize
20+
flexibility, this library does not actually handle any network I/O, such as
21+
opening a socket or negotiating a WebSocket protocol. Instead, that
22+
responsibility is left to higher-level libraries, for example
23+
`trio-chrome-devtools-protocol
24+
<https://github.com/hyperiongray/trio-chrome-devtools-protocol>`_.
25+
26+
To install (requires Python ≥3.7):
27+
28+
.. code-block::
29+
30+
$ pip install chrome-devtools-protocol
31+
32+
Sample code:
33+
34+
.. code-block::
35+
36+
from cdp import page
37+
38+
frame_id = page.FrameId('my id')
39+
assert repr(frame_id) == "FrameId('my id')"

0 commit comments

Comments
 (0)