Skip to main content

flatbencode

https://travis-ci.org/acatton/flatbencode.svg?branch=master

Fast, safe and thoroughly tested implementation of bencode in pure Python 3, without any C extension.

This is called flatbencode because the algorithm for decoding a bencode structure is non-recursive, thus preventing RuntimeException.

Usage

>>> from flatbencode import encode, decode
>>> encode({b'foo': [b'bar', 1]})
b'd3:fool3:bari1eee'
>>> decode(b'ldei0e0:e')
[OrderedDict(), 0, b'']

Run tests

$ pip install pytest hypothesis
$ py.test -v

Changelog

v0.2.1 (2016-10-22)

  • Do not accept strings as dictionary keys [Antoine Catton]

v0.2.0 (2016-10-22)

  • Raise an exception when there’s still data left. [Tim Ruffing, #2]

  • Use bytes as python dictionary keys (instead of strings) [Tim Ruffing, #2]

  • Sort dictionary keys when serializing (follows the BEP-0003) [Antoine Catton]

v0.1.0 (2016-06-12)

  • Initial release.

  • Can decode bencoding into a python datastructure.

  • Can encode a python datastructure into bencoding serialization format.

Metadata

Release files for flatbencode 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for flatbencode 0.2.1
File Size Uploaded Provenance Actions
flatbencode-0.2.1.tar.gz 3.2 kB Without provenance Details for flatbencode-0.2.1.tar.gz

Release files / flatbencode-0.2.1.tar.gz

Download URL flatbencode-0.2.1.tar.gz
Size 3.2 kB
Tags Source
SHA-256 checksum
How to use checksums
77397d5d0108835404f6f7cad640d403c7025a11812afc7e1df4b0f92589ba77
BLAKE2b-256 checksum
How to use checksums
963ded36c2a94bef2ff1b7fc62ba932fa2eb4db3f7ea30c89da01b1c64ecbb8c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for flatbencode 0.2.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.2.1 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page