Chunked transfer encoding as defined in RFC 7230
Project description
httpchunked
Do you need support for chunked transfer encoding in your Python web server,
without adding a dependency on a complete framework? Then httpchunked
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 httpchunked 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 httpchunked 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.1.tar.gz
(2.1 kB
view hashes)
Built Distribution
Close
Hashes for httpchunked-0.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a3905b8d4211de7fb7f3727ee8e83a434a8a1d6fea287579e1986e675cbd5fc0 |
|
MD5 | 7d7da470c3596b9242ace604ac21f680 |
|
BLAKE2b-256 | 79bfebab8f02a67af36dd147b1277dc90b2377cf6a556c4d9adb31ab15f06353 |