Skip to content

whtsky/bencoder.pyx

Repository files navigation

Bencoder.pyx

A fast bencode implementation in Cython supports both Python2 & Python3 .

https://travis-ci.org/whtsky/bencoder.pyx.svg?branch=master https://ci.appveyor.com/api/projects/status/ur6vy8wdj789oxqv/branch/master?svg=true

Install

pip install bencoder.pyx

Usage

from bencoder import bencode, bdecode

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'])

ChangeLog

Version 1.1.0

  • Use OrderedDict instaed of dict
  • Support encoding subclasses of dict

About

A fast bencode implementation in Cython

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 9