Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
a torrent downloader using tornado's ioloop and iostream
Python JavaScript
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.


IMPORTANT NOTE: this project requires a custom version of tornado from that has a special
IOStream.read_chunk method. Please install this using virtualenv. If
you don't know how to use virtualenv, first learn about that.

SECONDARY NOTE: some features require a patched bencode

def bdecode(x,strict=True):                                                             
        r, l = decode_func[x[0]](x, 0)                                                                                                                                  
    except (IndexError, KeyError, ValueError):                                                                                                                          
        raise BTFailure("not a valid bencoded string")                                                                                                                  
    if l != len(x) and strict:                                                                                                                                          
        raise BTFailure("invalid bencoded value (data after valid prefix)")                                                                                             
    return r                                                                

torrent client using tornado's ioloop.
fast and efficient for downloading files.

now downloads from non-100% complete peers

has support for ut_metadata extension


Accepts connections on options.port, and attempts to download from
anyone who connects on that port and sends a valid BitTorrent
handshake message. If the handshake message includes the extension
which supports sending the torrent metadata, it will request that

Also with startup options it can initiate a connection to another

python -m ktorrent.serve


try running uTorrent and with a torrent selected, go to the "peers"
pane, right click, "add peer" and enter the host:port (default port
8030) and start the torrent. You should see ktorrent start to download

Other options:

- options.datapath - place to store torrent files and torrent data

- options.resume_file - place to store torrent metadata info (infohash
to .torrent file disk location mapping)

- options.startup_connect_to - give an ip:port and it will initiate a
handshake with this address, using either:

  - options.startup_connect_torrent (a filesystem path of a .torrent file)
  - options.startup_connet_to_hash (a 40 character hex torrent infohash)

- if options.startup_exit_on_close is specified, the program will quit
after the first peer connection closes.

Currently not very useful options:

- options.frontend_port - a web interface for controlling/observing
  program behavior (has no functionality -- yet)

- options.static_path - where the web interface can serve static files
  from (like html or images)

- options.template_path - where the web interface can serve template
  files from (for html)
Something went wrong with that request. Please try again.