Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (
Help us improve Python packaging - Donate today!

Simple torrent client on top of libtorrent rasterbar

Project Description

Stupid, simple torrent client built on top of libtorrent python binding.

Let you add torrents files and magnet and receive libtorrent alerts. That’s all !

  • Free software: WTFPL


  • TODO

Full example

This example show how to add a magnet uri and how to create an alert handler.

Alert handler methods sould be named ‘on_ALERT’, with ALERT the type of alert to handle.

All methods will receive the session as first argument and the alert as the second.

Please note that this example is not exhaustive.

# coding: utf-8
import sys
import os
import time
import logging

from sstc.sstc import TorrentClient

logger = logging.getLogger(__name__)

class AlertHandler(object):
    def on_torrent_added_alert(self, session, alert):

    def on_state_changed_alert(self, session, alert):

    def on_torrent_resumed_alert(self, session, alert):

    def on_torrent_checked_alert(self, session, alert):
        handler = alert.handle
        info = handler.get_torrent_info()
        files = info.files()
        # Do something with torrent infos, like filter files to download
        # torrent was added paused, we resume it

    def on_torrent_finished_alert(self, session, alert):
        # if you want to remove the torrent immediately :

    def on_piece_finished_alert(self, session, alert):
        handler = alert.handle

    def on_block_finished_alert(self, session, alert):
        handler = alert.handle

    def on_file_completed_alert(self, session, alert):
        handler = alert.handle
        info = handler.get_torrent_info()
        f = info.file_at(alert.index)
        logger.debug("%s : completed", f.path)

def main():
    # starts client with 100Mib/s download limit
    # and 10Mib/s uploadlimit
    client = TorrentClient(
        download_rate_limit=100 << 20,
        upload_rate_limit=10 << 20,

    # start client alert dispatcher

        # support local torrentfile
        # also magnet url
        # also from http/https url

        for item in to_download:
            client.add(item, is_paused=True, alert_handler=AlertHandler())

        # Blocking loop

    except (KeyboardInterrupt, Exception) as e:

if __name__ == "__main__":


0.1.0 (2015-01-11)

  • First release on PyPI.
Release History

Release History

This version
History Node


Download Files

Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
sstc-0.1.0-py2.7.egg (9.3 kB) Copy SHA256 Checksum SHA256 2.7 Egg Mar 28, 2015
sstc-0.1.0-py2.py3-none-any.whl (7.4 kB) Copy SHA256 Checksum SHA256 2.7 Wheel Mar 28, 2015
sstc-0.1.0.tar.gz (14.7 kB) Copy SHA256 Checksum SHA256 Source Mar 28, 2015

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting