Debian Codegraph @

testing/web-platform/tests/tools/third_party/hyperframe/docs/source/index.rst

raw
1 hyperframe: HTTP/2 Framing for Python
2 =====================================
3
4 hyperframe is a pure-Python tool for working with HTTP/2 frames. This library
5 allows you to create, serialize, and parse HTTP/2 frames.
6
7 Working with it is easy:
8
9 .. code-block:: python
10
11 import hyperframe.frame
12
13 f = hyperframe.frame.DataFrame(stream_id=5)
14 f.data = b'some binary data'
15 f.flags.add('END_STREAM')
16 f.flags.add('PADDED')
17 f.padding_length = 30
18
19 data = f.serialize()
20
21 new_frame, length = hyperframe.frame.Frame.parse_frame_header(data[:9])
22 new_frame.parse_body(memoryview(data[9:9 + length]))
23
24 hyperframe is pure-Python, contains no external dependencies, and runs on a
25 wide variety of Python interpreters and platforms. Made available under the MIT
26 license, why write your own frame parser?
27
28 Contents:
29
30 .. toctree::
31 :maxdepth: 2
32
33 installation
34 api