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.1.tar.gz
(16.8 kB
view details)
Built Distribution
File details
Details for the file bencode.py-3.0.1.tar.gz
.
File metadata
- Download URL: bencode.py-3.0.1.tar.gz
- Upload date:
- Size: 16.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/2.7.15
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3caad17ed5712a84ac90e86919b61c936d18a0d2123d6bab33330a694b645f51 |
|
MD5 | c65e3673d6d38cb0af955d7deedc7d31 |
|
BLAKE2b-256 | 536d530affcf38b085ce8a58267252575b4aa02dd07e7bd0e1e4c415e004c320 |
Provenance
File details
Details for the file bencode.py-3.0.1-py2.py3-none-any.whl
.
File metadata
- Download URL: bencode.py-3.0.1-py2.py3-none-any.whl
- Upload date:
- Size: 14.6 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/2.7.15
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0c94470087228c3b18461b4a00ddf939a98868ac0e74f690b792b9f244d31e6d |
|
MD5 | 3a5825ec4854cd1b29f17ff7846bf5f6 |
|
BLAKE2b-256 | bf47a680bec9c96c336e3523327c633c36d7d32fe44f6e03c4da380c6e59a1f4 |