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
Release history Release notifications | RSS feed
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)