Skip to main content
Archived

This project has been archived by its maintainers, and is no longer receiving any updates.

This is a BitTorrent client written entirely in Python so that it can be easily used for experiments. It is a fully working BitTorrent client so you can use it below as an example. There is no intelligence in this such as getting rarest peice first. Everything is random.

It doesn’t use thread or multiprocessing as it’s designed to be used for experiments, and I don’t know how someone may want to use it, while also making it impractical for general use, but I’d like to eventually support the most common schemes such as DHT, Magnet URLs, PHE tDP, and UPnP so it is possible to accept incoming connections.

Installation

PIP

pip install pythorrent

From Source

pip install -r requirements.txt
python setup.py install

Usage

Depending on how you installed PYTHorrent you may need to go to the root of the source of the PYTHorrent directory.

cd python-pythorrent

Getting commands

python -m pythorrent -h

Downloading a Torrent using a torrent file

python -m pythorrent --file ubuntu-16.04-desktop-amd64.iso.torrent --path . --log=info

Overview

Documentation for the BitTorrent protocol is poor but these sources have been immensely helpful: - http://jonas.nitro.dk/bittorrent/bittorrent-rfc.html - https://wiki.theory.org/BitTorrentSpecification - http://www.kristenwidman.com/blog/33/how-to-write-a-bittorrent-client-part-1/ - http://www.kristenwidman.com/blog/71/how-to-write-a-bittorrent-client-part-2/

License

AGPLv3

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.

To Do

Tidy up documentation

Memory efficiency

  • Only load piece data in to memory when it is needed.

Magnet URL Scheme

DHT

Options? - https://github.com/drxzcl/lightdht/ - I like this one best - Seems to lock out when finding peers - https://github.com/gsko/mdht

Encryption? PHE

UPnP

** Always download legal torrents **

Release files for pythorrent 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pythorrent 0.1.0
File Size Uploaded
PYTHorrent-0.1.0.tar.gz 15.0 kB Details

Release files / PYTHorrent-0.1.0.tar.gz

Download URL PYTHorrent-0.1.0.tar.gz
Size 15.0 kB
Tags Source
SHA-256 checksum
How to use checksums
4f49ca921d96b9d1d4462e04903ca66463ef6c16d5b2ffd5240be44fe1152b4f
BLAKE2b-256 checksum
How to use checksums
cb997becf64a505625c219e142571d2c656e5a9f897a4579ac9ba6abfccdfa24
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.1.0 This release

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page