bcoder
About
A Python package to handle bencoded values, a serialization format commonly used in .torrent files within
the BitTorrent protocol.
Usage
There are 2 types of classes:
BDecoder- handle decoding of bencoded data to common Python typesBEncoder- handle encoding of common Python types tobytestype
Example of BDecoder usage:
from bcoder import BDecoder
decoder = BDecoder()
with open("file.torrent", "rb") as file:
data = file.read()
decoded = decoder.decode(data)
Example of BEncoder usage:
from bcoder import BEncoder
encoder = BEncoder()
data = {
b"announce-list": [
[b"udp:..."],
[b"udp:..."],
],
b"info": {
b"piece": b"xfsasf",
b"piece length": 123,
},
}
encoded = encoder.encode(data)
NOTE: BEncoder is spec-strict (BEP 3). Only bytes, int, list, and dict with bytes keys are accepted. Pass str through .encode("utf-8") yourself if you need to encode text.
Metadata
Release files for bcoder 2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| bcoder-2.0.tar.gz | 3.7 kB | Without provenance | Details for bcoder-2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| bcoder-2.0-py3-none-any.whl | Python 3 | none | any | Details for bcoder-2.0-py3-none-any.whl |
Total release size: 8.7 kB
Release files / bcoder-2.0.tar.gz
| Download URL | bcoder-2.0.tar.gz |
|---|---|
| Size | 3.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d1fe8b934a5b483cd991da624202b1825d69b009f4816c01a2e750f81dabc287
|
|
BLAKE2b-256 checksum How to use checksums |
3049589554069b6db78f6ac63b72f71701a4b9a3fc2afd7e885ed4856446e964
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.4
|
Release files / bcoder-2.0-py3-none-any.whl
| Download URL | bcoder-2.0-py3-none-any.whl |
|---|---|
| Size | 5.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8da611e2b6bdd392805b752402d24238090180cea2e4a66b67f28c8c58e4a22b
|
|
BLAKE2b-256 checksum How to use checksums |
17a64c616cfe03647212013ef2124e01700a1958b0fbffd5597570415b97c6d5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.4
|
Security for bcoder 2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.