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-2.0.0.tar.gz
(7.3 kB
view details)
Built Distribution
File details
Details for the file bencode.py-2.0.0.tar.gz
.
File metadata
- Download URL: bencode.py-2.0.0.tar.gz
- Upload date:
- Size: 7.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 067cf936e29a7b698d2b4d00902343b78d434d73d837c33d6ca1a8be6038fe72 |
|
MD5 | 74f0c06610b5c1877ea185e3b2d62dd4 |
|
BLAKE2b-256 | efac06db2aeeda4ccc238bc6d7f17dae62d64c632b9a72ba8eb4e2c5fd56f7d9 |
Provenance
File details
Details for the file bencode.py-2.0.0-py2.py3-none-any.whl
.
File metadata
- Download URL: bencode.py-2.0.0-py2.py3-none-any.whl
- Upload date:
- Size: 6.4 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 58c515e4b81b1d45225d4a9e38ba4532acc94b9b7cf7be29bc5e62af3226a8f2 |
|
MD5 | c5ca59abef640319389ecce485098d50 |
|
BLAKE2b-256 | 1f09cda159542fe188706de49734e26522c360affe79f8dcf01e807f72cdfc7f |