Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

whtsky/bencoder.pyx

Open more actions menu

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

Morty Proxy This is a proxified and sanitized view of the page, visit original site.