Skip to main content

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


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.0.tar.gz (39.7 kB view details)

Uploaded Source

Built Distribution

bencoded-0.1.0-py3-none-any.whl (39.9 kB view details)

Uploaded Python 3

File details

Details for the file bencoded-0.1.0.tar.gz.

File metadata

  • Download URL: bencoded-0.1.0.tar.gz
  • Upload date:
  • Size: 39.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.8.10 Darwin/23.5.0

File hashes

Hashes for bencoded-0.1.0.tar.gz
Algorithm Hash digest
SHA256 c12ac33be8a9bdcfd7cda93a5a9b17f85fe1f17fd2712437042a7a61bc3cbe64
MD5 2cdc077d93742f7dec416b4361e31f75
BLAKE2b-256 9945cc8ce14b5523010ff31c0bf919887d84aa59568358ccdcb58c4963ba907f

See more details on using hashes here.

File details

Details for the file bencoded-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: bencoded-0.1.0-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

Hashes for bencoded-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c777c922ba7315ab8ed015d4a916ce8b4fcb6f230502dacf1a2da2750cf79ccc
MD5 1696c0f4b908f9871f68a1d336bd08b7
BLAKE2b-256 2b3b833b61fb1cbb60cd208481c5da9a0a26bd68f43ad5201a74ad90b5fbad58

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page