Decode benocoded binary files.
Project description
bencoding
bencoding
is a simple Python library for decoding bencoded data.
Installation
pip install bencoded
Usage
import bencoding
data = bencoding.decode(b'li1ei2ei3ee')
print(data) # [1, 2, 3]
data = bencoding.decode(b'd3:foo3:bare')
print(data) # {'foo': 'bar'}
data = bencoding.decode(b'i42e')
print(data) # 42
data = bencoding.decode(b'4:spam')
print(data) # 'spam'
my_torrent = pathlib.Path('my_torrent.torrent')
my_torrent_bytes = my_torrent.read_bytes()
data = bencoding.decode(my_torrent_bytes)
print(data) # {'announce': 'http://tracker.example.com:80/announce', ...}
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
bencoded-0.1.1.tar.gz
(39.8 kB
view details)
Built Distribution
bencoded-0.1.1-py3-none-any.whl
(39.9 kB
view details)
File details
Details for the file bencoded-0.1.1.tar.gz
.
File metadata
- Download URL: bencoded-0.1.1.tar.gz
- Upload date:
- Size: 39.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.8.10 Darwin/23.5.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | aeb3682ff6a93a49785af9a0dfb04fd116495a54fd5bbff364221121dbdfbf7c |
|
MD5 | 7e701f4cb68d8478db2feb7ad4bd4dd4 |
|
BLAKE2b-256 | 2cc87048eea5f6497e974be98f9b1d9df936b100a5550b6c6f7d13958e96db25 |
File details
Details for the file bencoded-0.1.1-py3-none-any.whl
.
File metadata
- Download URL: bencoded-0.1.1-py3-none-any.whl
- Upload date:
- Size: 39.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.8.10 Darwin/23.5.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2c7c14cb8a8d6d6c2805d4c7c3f67f0a7142769fa6863072d3a69033e1b0219b |
|
MD5 | 4926e58a6e65539ef3a09ac9392b3545 |
|
BLAKE2b-256 | 4d1194fb423a52e57fa754e11bbc8424fad317d847c66a5e6e7f13a57df5e6e2 |