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

Uploaded Source

Built Distribution

bencode.py-2.0.0-py2.py3-none-any.whl (6.4 kB view details)

Uploaded Python 2 Python 3

File details

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

File metadata

  • Download URL: bencode.py-2.0.0.tar.gz
  • Upload date:
  • Size: 7.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for bencode.py-2.0.0.tar.gz
Algorithm Hash digest
SHA256 067cf936e29a7b698d2b4d00902343b78d434d73d837c33d6ca1a8be6038fe72
MD5 74f0c06610b5c1877ea185e3b2d62dd4
BLAKE2b-256 efac06db2aeeda4ccc238bc6d7f17dae62d64c632b9a72ba8eb4e2c5fd56f7d9

See more details on using hashes here.

Provenance

File details

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

File metadata

File hashes

Hashes for bencode.py-2.0.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 58c515e4b81b1d45225d4a9e38ba4532acc94b9b7cf7be29bc5e62af3226a8f2
MD5 c5ca59abef640319389ecce485098d50
BLAKE2b-256 1f09cda159542fe188706de49734e26522c360affe79f8dcf01e807f72cdfc7f

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