Skip to content
JackyHe398 on OldHome_main edited this page Aug 1, 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 and download metadata
  • process peer exchange (ut_pex) messages
  • edit and rebuild .torrent files
  • parse magnet links, including tracker and peer hints

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

Library overview

Installation

pip install torrentlib

Python 3.10 through 3.14 are supported.

To begin using the library, start by creating a Torrent object from metainfo, an info hash, or a magnet link, and then querying trackers for peers. If you start without full metainfo, 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.

License

The project is distributed using MIT. See LICENSE.

Clone this wiki locally