Skip to content
Jacky He edited this page Jun 14, 2026 · 6 revisions

Welcome to the torrentlib wiki!

torrentlib

Python helpers for BitTorrent tracker queries, peer communication, and metadata inspection.

torrentlib is not a full BitTorrent client. It can:

  • load .torrent metadata
  • announce to HTTP and UDP trackers
  • collect IPv4 and IPv6 peer lists
  • connect to peers that support the extension protocol
  • download torrent metadata from peers via ut_metadata
  • process peer exchange (ut_pex) messages

It does not manage piece downloads/uploads for complete content transfer.

Library overview

To begin using the library, start by creating a Torrent object and then querying trackers for living peers. If you instantiate the Torrent object using an info hash or a magnet link, you will also need to contact a peer to download the metadata.

Beyond the core torrent lifecycle, the library provides built-in interfaces to check tracker health and to modify, retrieve information from, or rebuild .torrent files. For implementation details and troubleshooting, you can explore the error handling guide and comprehensive usage examples.

Clone this wiki locally