A fast and correct bencode serialize/deserialize library
Project description
A fast and correct bencode serialize/deserialize library
This library is compiled with mypy on cpython, and pure python on pypy.
install
pip install bencode2
basic usage
import bencode2
assert bencode2.bdecode(b"d4:spaml1:a1:bee") == {b"spam": [b"a", b"b"]}
# If you want to decode dict with str keys:
# Note: this doesn't work with BitTorrent V2 torrent file.
assert bencode2.bdecode(b"d4:spaml1:a1:bee", str_key=True) == {"spam": [b"a", b"b"]}
assert bencode2.bencode({'hello': 'world'}) == b'd5:hello5:worlde'
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 Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
Close
Hashes for bencode2-0.0.22-cp310-cp310-macosx_10_16_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f2bf72fb8ce3d80c2ae1ea5160110e09bd0aa947aa99f5d5d7eb8dc8aaa373e5 |
|
MD5 | 1769edb052b62a5862b31463618622d7 |
|
BLAKE2b-256 | 8111e09be3b12475a9fc74d7b258eba7996fca895aa0794408dcf3c50e723c3c |