Skip to main content

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

Project description

https://img.shields.io/pypi/v/bencode.py.svg?style=flat-square https://img.shields.io/travis/fuzeman/bencode.py.svg?style=flat-square https://img.shields.io/coveralls/fuzeman/bencode.py/master.svg?style=flat-square

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.

bencode.bread(fd)

Read bencode formatted string from file or path fd.

bencode.bwrite(data, fd)

Write data as a bencode formatted string to file or path fd.

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

bencode.py-3.0.0.tar.gz (16.8 kB view details)

Uploaded Source

Built Distribution

bencode.py-3.0.0-py2.py3-none-any.whl (14.6 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file bencode.py-3.0.0.tar.gz.

File metadata

  • Download URL: bencode.py-3.0.0.tar.gz
  • Upload date:
  • Size: 16.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/2.7.15

File hashes

Hashes for bencode.py-3.0.0.tar.gz
Algorithm Hash digest
SHA256 e7bade306f0e31ecf31269e010a547b502f06a019d86f0dceeb0597920ce47fd
MD5 31e46bf50b1b62bd4a8da0a19ec8cdb4
BLAKE2b-256 93a0ad7f0d2f2403dc95db1587b6abb1c893269274406e18c2d1d0ee3a48182f

See more details on using hashes here.

Provenance

File details

Details for the file bencode.py-3.0.0-py2.py3-none-any.whl.

File metadata

  • Download URL: bencode.py-3.0.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 14.6 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/2.7.15

File hashes

Hashes for bencode.py-3.0.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 164e626bfb0d2b4d81465f875e5d279f60e1283808385e44b84f976f380322ec
MD5 f779ad3ded8c1ce0cdf18625c4efdbaf
BLAKE2b-256 ca423da3ce383d8adc218adde7333a84f4fd72fd4f4ab2ba3652d3f36bce5708

See more details on using hashes here.

Provenance

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