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-2.1.0.tar.gz (17.1 kB view details)

Uploaded Source

Built Distribution

bencode.py-2.1.0-py2.py3-none-any.whl (14.9 kB view details)

Uploaded Python 2 Python 3

File details

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

File metadata

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

File hashes

Hashes for bencode.py-2.1.0.tar.gz
Algorithm Hash digest
SHA256 7d65b02f174097a442a2b138208aee7fe104d2ce79e7a29fb457d0e02f38fc3d
MD5 ea7c9dbc00846e23e473c68994ee1cb4
BLAKE2b-256 3dcff4c737f89a66c8156e0aec627d82cb25154d5444e4cceee236d33a0c6923

See more details on using hashes here.

Provenance

File details

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

File metadata

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

File hashes

Hashes for bencode.py-2.1.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 f08cb93d4bdf7ad4da675082e530d53ba02fb26ffa8b19c54c095e442a0a6bed
MD5 94957c142235f9e7d8805121e1933567
BLAKE2b-256 98d884d31b911a7cab865ec9070a982b9452b15db00373efcf1e4b4314a6a958

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