A fast bencode implementation in Cython
A fast bencode implementation in Cython supports both Python2 & Python3 .
.. image:: https://img.shields.io/pypi/l/bencoder.pyx.svg :alt: PyPI License :target: https://pypi.org/project/bencoder.pyx/ .. image:: https://codecov.io/gh/whtsky/bencoder.pyx/branch/master/graph/badge.svg :alt: Codecov Coverage :target: https://codecov.io/gh/whtsky/bencoder.pyx
.. code-block:: bash
pip install bencoder.pyx
.. code-block:: python
from bencoder import bencode, bdecode, bdecode2
assert bencode("WWWWWW") == b'6:WWWWWW'
assert bencode(233) == b'i233e'
with open("debian-8.3.0-amd64-netinst.iso.torrent", "rb") as f:
torrent = bdecode(f.read())
print(torrent['announce'])
decoded, length = bdecode2(b'6:WWWWWWi233e')
assert decoded == b'WWWWWW'
assert length == 8
Version 3.0.1
+ Add support for Python 3.11
Versoin 3.0.0
Version 2.0.1
+ Add support for Python 3.8
+ Drop support for Python 3.4
Version 2.0.0
#41 <https://github.com/whtsky/bencoder.pyx/pull/41>
_Version 1.2.1
+ Drop support for Python 2.6
+ Performance boost for `bencode` method. `#7 <https://github.com/whtsky/bencoder.pyx/issues/7>`_
Version 1.2.0
bdecode2
method. #6 <https://github.com/whtsky/bencoder.pyx/pull/6>
_Version 1.1.3
+ Performance Improvement
+ Fix package metainfo `#3 <https://github.com/whtsky/bencoder.pyx/issues/3>`_
Version 1.1.2
Version 1.1.0
+ Use OrderedDict instaed of dict
+ Support encoding subclasses of dict