Chunked transfer encoding as defined in RFC 7230
Project description
chunked
Do you need support for chunked transfer encoding in your Python web server,
without adding a dependency on a complete framework? Then chunked
is
the module you need! It has no third-party dependencies and consists of only
two functions: decode
and encode
.
Usage
Decoding
$ cat main.py
from io import BytesIO
from chunked import decode
if __name__ == "__main__":
dst = BytesIO()
src = BytesIO(b"3\r\nfoo\r\n0\r\n\r\n")
decode(dst, src)
raw = dst.getvalue()
print(raw)
$ python main.py
b'foo'
Encoding
$ cat main.py
from io import BytesIO
from chunked import encode
if __name__ == "__main__":
dst = BytesIO()
src = BytesIO(b"foo")
encode(dst, src)
raw = dst.getvalue()
print(raw)
$ python main.py
b'3\r\nfoo\r\n0\r\n\r\n'
Installation
pip install chunked
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
httpchunked-0.1.0.tar.gz
(2.1 kB
view hashes)
Built Distribution
Close
Hashes for httpchunked-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 723bedff2deec69ade80f986face641b72aae9bdab7fa9ccebb1a447a95f0415 |
|
MD5 | a2ca8910b5f5817bbd587e9097a58383 |
|
BLAKE2b-256 | 2cba5c823358b550129935cd40264bbe45bf7239ea1af40d4da0ef3587cf45f5 |