Skip to main content

An implementation of Bencode encoding in Python 3

Installation

From PyPI:

pip install torrent-bencode

Usage

import bencode
bencode.encode([b'spam', b'eggs'])
bencode.decode(b'l4:spam4:eggse')

Types

Type mapping for encoding:

Bencode type

Python type

Dictionary

OrderedDict

List

list

Byte string

bytes

Integer

int

Type mapping for decoding:

Python type

Bencode type

dict

Dictionary

list or tuple

List

bytes

Byte string

int

Integer

If an OrderedDict is passed rather than a plain dict, the order of items will be preserved.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

torrent-bencode-0.1.tar.gz (2.4 kB view details)

Uploaded Source

File details

Details for the file torrent-bencode-0.1.tar.gz.

File metadata

  • Download URL: torrent-bencode-0.1.tar.gz
  • Upload date:
  • Size: 2.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.28.1 CPython/3.7.2

File hashes

Hashes for torrent-bencode-0.1.tar.gz
Algorithm Hash digest
SHA256 59e7a6159c69e2ffee2cb0c8fcc0a4e98d866750f889e250c335fc5323e78cf7
MD5 7aaf493d36e93c129422b8690482f114
BLAKE2b-256 45d7e24446b488be9b3a1e363a1937124c5715fe10dd64c6b56a68cf680c2b3f

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 Sentry Error logging StatusPage Status page