index.rst (1052B)
1 hpack: HTTP/2 Header Compression for Python 2 =========================================== 3 4 hpack provides a simple Python interface to the `HPACK`_ compression algorithm, 5 used to compress HTTP headers in HTTP/2. Used by some of the most popular 6 HTTP/2 implementations in Python, HPACK offers a great Python interface as well 7 as optional upgrade to optimised C-based compression routines from `nghttp2`_. 8 9 Using hpack is easy: 10 11 .. code-block:: python 12 13 from hpack import Encoder, Decoder 14 15 e = Encoder() 16 encoded_bytes = e.encode(headers) 17 18 d = Decoder() 19 decoded_headers = d.decode(encoded_bytes) 20 21 hpack will transparently use nghttp2 on CPython if it's available, gaining even 22 better compression efficiency and speed, but it also makes available a 23 pure-Python implementation that conforms strictly to `RFC 7541`_. 24 25 Contents 26 -------- 27 28 .. toctree:: 29 :maxdepth: 2 30 31 installation 32 api 33 security/index 34 35 36 .. _HPACK: https://tools.ietf.org/html/rfc7541 37 .. _nghttp2: https://nghttp2.org/ 38 .. _RFC 7541: https://tools.ietf.org/html/rfc7541