Skip to main content

An implementation of Bencode encoding in Python 3

Project description

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.

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

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

Uploaded Source

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