1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
|
QPack
=====
QPack is a fast and efficient serialization format like MessagePack.
One key difference is flexible map and array support which allows
to write directly to a qpack buffer without the need to know
the size for the map or array beforehand.
Installation
------------
From PyPI (recommend)
```
pip install qpack
```
From source code
```
python setup.py install
```
Pack
----
`qpack.packb(object)`
Unpack
----
Unpack serialized data. When decode is left None, each string
will be returned as bytes.
`qpack.unpackb(qp, decode=None)`
Example
-------
```python
import qpack
# define some test data
data = {'name': 'Iris', 'age': 3}
# serialize into qpack format
qp = qpack.packb(data)
# unpack the serialized data
unpacked = qpack.unpackb(qp, decode='utf-8')
# left see what we've got...
print(unpacked) # {'name': 'Iris', 'age': 3}
```
|