Skip to main content

bencode parser and converter

Project description

bencode

bencode-open is an open-source MIT-licensed library for parsing and converting objects to and from Bencode format.

Rationale

bencode-open is MIT-licensed and can thus be included to almost all software, compared to bencode and bencode.py.

Installation

bencode-open is available on GitHub and on PyPI.

Installing bencode-open from PyPI is recommended and can be done as follows:

pip install bencode-open

Usage

import bencode_open

print(bencode_open.dumps(b"Hello?"))  # Outputs b"6:Hello?"
print(bencode_open.dumps(17))  # Outputs b"i17e"

print(bencode_open.loads(b"6:Hello?"))  # Outputs b"Hello?"
print(bencode_open.loads(b"i17e"))  # Outputs 17

Running tests

python test.py

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-open-1.2.tar.gz (2.3 kB view hashes)

Uploaded Source

Built Distribution

bencode_open-1.2-py3-none-any.whl (3.5 kB view hashes)

Uploaded Python 3

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