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

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

bencoded-0.1.2-py3-none-any.whl (3.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: bencoded-0.1.2.tar.gz
  • Upload date:
  • Size: 5.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.5.13

File hashes

Hashes for bencoded-0.1.2.tar.gz
Algorithm Hash digest
SHA256 57d16d88f5820f10413039a088231b9702f217a562e05e5f124eb9d240739bf2
MD5 c2f957bef168aa71776533088ca528d3
BLAKE2b-256 fd71db05eb0570439b33a60eae934da2700ff37f228acadbe9fba28948613419

See more details on using hashes here.

File details

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

File metadata

  • Download URL: bencoded-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 3.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.5.13

File hashes

Hashes for bencoded-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 3923bb64a7d281b5e04f8b7b261f35829762dfcd31668bf3a60a3e7bca8f0387
MD5 f3ac82e10ea163327f127cd75290c996
BLAKE2b-256 4c6a9040b351291aff4bfdb68ba234e0bb991dd05d051e01de8a6f6fd4f2efc7

See more details on using hashes here.

Supported by

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