Skip to main content

Simple bencoding decode/encode library 🔖

Install

pip install bencodingpy

Usage

Decode

>>> from bencodingpy import decode

>>> decode(b'4:spam')
'spam'

>>> decode(b'i1234e')
1234

>>> decode(b'l4:spam4:eggse')
['spam', 'eggs']

>>> decode(b'd4:spaml1:a1:bee ')
{'spam': ['a', 'b']}

>>> with open('debian-12.5.0-amd64-netinst.iso.torrent', 'rb') as file:
...     decoded_torrent = decode(file)
...     print(decoded_torrent['announce'])
... 
http://bttracker.debian.org:6969/announce

Encode

>>> from bencodingpy import encode

>>> encode('spam')
b'4:spam'

>>> encode(1234)
b'i1234e'

>>> encode(['spam', 'eggs'])
b'l4:spam4:eggse'

>>> encode({'spam': ['a', 'b']})
b'd4:spaml1:a1:bee'

Metadata

Release files for bencodingpy 1.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for bencodingpy 1.0.2
File Size Uploaded Provenance Actions
bencodingpy-1.0.2.tar.gz 69.6 kB Without provenance Details for bencodingpy-1.0.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for bencodingpy 1.0.2
File Interpreter ABI Platform Actions
bencodingpy-1.0.2-py3-none-any.whl Python 3 none any Details for bencodingpy-1.0.2-py3-none-any.whl

Total release size: 87.2 kB

Release files / bencodingpy-1.0.2.tar.gz

Download URL bencodingpy-1.0.2.tar.gz
Size 69.6 kB
Tags Source
SHA-256 checksum
How to use checksums
ac1b476b1f8ff2a9680f0402e5f8945e76d6e30bd09cd1b9da8ae171379029f6
BLAKE2b-256 checksum
How to use checksums
f7701c948a405fe8536eb53f9c85f65c514c128e411468149f4d75df1798335c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.1.dev0+g94f810c.d20240510 CPython/3.12.7

Release files / bencodingpy-1.0.2-py3-none-any.whl

Download URL bencodingpy-1.0.2-py3-none-any.whl
Size 17.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fc751078a3b97fa3e67039ccbe65c71c24982250164c60000f516bc4dde99ad8
BLAKE2b-256 checksum
How to use checksums
0bf2580651fbde7748178334dc335f49266ce4909783b19bb483df27c634a1cc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.1.dev0+g94f810c.d20240510 CPython/3.12.7

Security for bencodingpy 1.0.2

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page