Skip to content

whtsky/bencoder.pyx

Repository files navigation

Bencoder.pyx

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

https://img.shields.io/travis/whtsky/bencoder.pyx/master.svg?maxAge=3600&label=macOS https://img.shields.io/appveyor/ci/whtsky/bencoder-pyx/master.svg?maxAge=3600&label=Windows https://img.shields.io/travis/whtsky/bencoder.pyx/master.svg?maxAge=3600&label=wheels

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.2

  • Support encode large int

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