skip to navigation
skip to content

bencode.py 1.2.0

Simple bencode parser (for Python 2, Python 3 and PyPy)

Simple bencode parser (for Python 2, Python 3 and PyPy), forked from the bencode package by Thomas Rampelberg.

Usage

Encode:

import bencode

bencode.encode({'title': 'Example'})
# 'd5:title7:Examplee'

bencode.encode(12)
# 'i12e'

Decode:

import bencode

bencode.decode('d5:title7:Examplee')
# {'title': 'Example'}

bencode.decode('i12e')
# 12

API

bencode.bencode(value)

bencode.encode(value)

Encode value into the bencode format.

bencode.bdecode(value)

bencode.decode(value)

Decode bencode formatted string value.
 
File Type Py Version Uploaded on Size
bencode.py-1.2.0-py2.py3-none-any.whl (md5) Python Wheel 2.7 2017-02-23 4KB
bencode.py-1.2.0.tar.gz (md5) Source 2017-02-23 5KB