Simple bencode parser (for Python 2, Python 3 and PyPy)
Project description
Simple bencode parser (for Python 2, Python 3 and PyPy), forked from the bencode package by Thomas Rampelberg.
Usage
Encode:
import bencode
bencode.encode({'title': 'Example'})
# 'd5:title7:Examplee'
bencode.encode(12)
# 'i12e'
Decode:
import bencode
bencode.decode('d5:title7:Examplee')
# {'title': 'Example'}
bencode.decode('i12e')
# 12
API
bencode.bencode(value)
bencode.encode(value)
Encode value into the bencode format.
bencode.bdecode(value)
bencode.decode(value)
Decode bencode formatted string value.
bencode.bread(fd)
Read bencode formatted string from file or path fd.
bencode.bwrite(data, fd)
Write data as a bencode formatted string to file or path fd.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
bencode.py-3.0.0.tar.gz
(16.8 kB
view hashes)
Built Distribution
Close
Hashes for bencode.py-3.0.0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 164e626bfb0d2b4d81465f875e5d279f60e1283808385e44b84f976f380322ec |
|
MD5 | f779ad3ded8c1ce0cdf18625c4efdbaf |
|
BLAKE2b-256 | ca423da3ce383d8adc218adde7333a84f4fd72fd4f4ab2ba3652d3f36bce5708 |