# TorrentP
## Wrapped python library for downloading from torrent
[](https://pypi.org/project/torrentp/)
### Download from torrent with .torrent file or magnet link. With just 3 lines of python code.
[](https://pypi.org/project/TorrentP)
[](#Installation)
[](https://pepy.tech/project/TorrentP)
### Installation
```sh
$ pip install torrentp
```
Also can be found on [pypi](https://pypi.org/project/torrentp/)
### How can I use it?
- Install the package by pip package manager.
- After installing, you can use it and call the library.
- You have to pass magnet link or torrent file, and a path for saving the file. use . (dot) for saving in current directory.
Download with magnet link:
```python
import asyncio
from torrentp import TorrentDownloader
torrent_file = TorrentDownloader("magnet:...", '.')
# Start the download process
asyncio.run(torrent_file.start_download()) # start_download() is a asynchronous method
# Pausing the download
torrent_file.pause_download()
# Resuming the download
torrent_file.resume_download()
# Stopping the download
torrent_file.stop_download()
```
Or download with .torrent file:
```python
import asyncio
from torrentp import TorrentDownloader
torrent_file = TorrentDownloader("test.torrent", '.')
# Start the download process
asyncio.run(torrent_file.start_download()) # start_download() is a asynchronous method
# Pausing the download
torrent_file.pause_download()
# Resuming the download
torrent_file.resume_download()
# Stopping the download
torrent_file.stop_download()
```
#### How can I use a custom port?
```python
torrent_file = TorrentDownloader("magnet/torrent.file", '.', port=0000)
```
#### How can I limit the upload or download speed?
Download Using 0 (default number) means unlimited speed:
```python
await torrent_file.start_download(download_speed=0, upload_speed=0)
```
Or download with specifc number (kB/s):
```python
await torrent_file.start_download(download_speed=2, upload_speed=1)
```
### Using Command Line Interface (CLI)
Download with a magnet link:
```sh
$ torrentp --link 'magnet:...'
```
or download with .torrent file:
```sh
$ torrentp --link 'test.torrent'
```
#### You can also use ```--help``` parameter to display all the parameters that you can use
| args | help | type |
| ------ | ------ | ------ |
| --link | Torrent link. Example: [--link 'file.torrent'] or [--link 'magnet:...'] [required] | ```str``` |
| --download_speed | Download speed with a specific number (kB/s). Default: 0, means unlimited speed | ```int``` |
| --upload_speed | Upload speed with a specific number (kB/s). Default: 0, means unlimited speed | ```int``` |
| --save_path | Path to save the file, default: '.' | ```str``` |
| --help |Show this message and exit | |
Example with all commands:
```sh
$ torrentp --link 'magnet:...' --download_speed 100 --upload_speed 50 --save_path '.'
```
### To do list
- [x] Limit upload and download speed
- [x] User can change the port
- [x] CLI
- [x] Pause / Resume / Stop
## Star History
[](https://star-history.com/#iw4p/torrentp&Date)
### Issues
Feel free to submit issues and enhancement requests or contact me via [vida.page/nima](https://vida.page/nima).
### Contributing
Please refer to each project's style and contribution guidelines for submitting patches and additions. In general, we follow the "fork-and-pull" Git workflow.
1. **Fork** the repo on GitHub
2. **Clone** the project to your own machine
3. **Update the Version** inside __init__.py
4. **Commit** changes to your own branch
5. **Push** your work back up to your fork
6. Submit a **Pull request** so that we can review your changes
Raw data
{
"_id": null,
"home_page": "https://github.com/iw4p/torrentp",
"name": "torrentp",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": null,
"author": "Nima Akbarzade",
"author_email": "iw4p@protonmail.com",
"download_url": "https://files.pythonhosted.org/packages/1b/19/86f2f111b68a0d24c19c5b0ef51517be74a183aa9076f4421cff36bf9b1e/torrentp-0.2.2.tar.gz",
"platform": null,
"description": "# TorrentP\n\n## Wrapped python library for downloading from torrent\n\n[](https://pypi.org/project/torrentp/)\n\n### Download from torrent with .torrent file or magnet link. With just 3 lines of python code.\n\n[](https://pypi.org/project/TorrentP)\n[](#Installation)\n[](https://pepy.tech/project/TorrentP)\n\n### Installation\n\n```sh\n$ pip install torrentp\n```\nAlso can be found on [pypi](https://pypi.org/project/torrentp/)\n\n### How can I use it?\n - Install the package by pip package manager.\n - After installing, you can use it and call the library.\n - You have to pass magnet link or torrent file, and a path for saving the file. use . (dot) for saving in current directory.\n\nDownload with magnet link:\n```python\nimport asyncio\nfrom torrentp import TorrentDownloader\ntorrent_file = TorrentDownloader(\"magnet:...\", '.')\n# Start the download process\nasyncio.run(torrent_file.start_download()) # start_download() is a asynchronous method \n\n# Pausing the download\ntorrent_file.pause_download()\n\n# Resuming the download\ntorrent_file.resume_download()\n\n# Stopping the download\ntorrent_file.stop_download()\n```\nOr download with .torrent file:\n```python\nimport asyncio\nfrom torrentp import TorrentDownloader\ntorrent_file = TorrentDownloader(\"test.torrent\", '.')\n# Start the download process\nasyncio.run(torrent_file.start_download()) # start_download() is a asynchronous method \n\n# Pausing the download\ntorrent_file.pause_download()\n\n# Resuming the download\ntorrent_file.resume_download()\n\n# Stopping the download\ntorrent_file.stop_download()\n```\n#### How can I use a custom port?\n\n```python\ntorrent_file = TorrentDownloader(\"magnet/torrent.file\", '.', port=0000)\n```\n#### How can I limit the upload or download speed?\n\nDownload Using 0 (default number) means unlimited speed:\n```python\nawait torrent_file.start_download(download_speed=0, upload_speed=0)\n```\nOr download with specifc number (kB/s):\n```python\nawait torrent_file.start_download(download_speed=2, upload_speed=1)\n```\n### Using Command Line Interface (CLI)\nDownload with a magnet link:\n```sh\n$ torrentp --link 'magnet:...'\n```\n\nor download with .torrent file:\n```sh\n$ torrentp --link 'test.torrent'\n```\n#### You can also use ```--help``` parameter to display all the parameters that you can use\n\n| args | help | type |\n| ------ | ------ | ------ |\n| --link | Torrent link. Example: [--link 'file.torrent'] or [--link 'magnet:...'] [required] | ```str``` |\n| --download_speed | Download speed with a specific number (kB/s). Default: 0, means unlimited speed | ```int``` |\n| --upload_speed | Upload speed with a specific number (kB/s). Default: 0, means unlimited speed | ```int``` |\n| --save_path | Path to save the file, default: '.' | ```str``` |\n| --help |Show this message and exit | |\n\nExample with all commands:\n```sh\n$ torrentp --link 'magnet:...' --download_speed 100 --upload_speed 50 --save_path '.'\n```\n\n### To do list\n- [x] Limit upload and download speed\n- [x] User can change the port\n- [x] CLI\n- [x] Pause / Resume / Stop\n\n## Star History\n\n[](https://star-history.com/#iw4p/torrentp&Date)\n\n### Issues\nFeel free to submit issues and enhancement requests or contact me via [vida.page/nima](https://vida.page/nima).\n\n### Contributing\nPlease refer to each project's style and contribution guidelines for submitting patches and additions. In general, we follow the \"fork-and-pull\" Git workflow.\n\n 1. **Fork** the repo on GitHub\n 2. **Clone** the project to your own machine\n 3. **Update the Version** inside __init__.py\n 4. **Commit** changes to your own branch\n 5. **Push** your work back up to your fork\n 6. Submit a **Pull request** so that we can review your changes\n",
"bugtrack_url": null,
"license": "BSD 2-clause",
"summary": "Download from torrent with magnet link or .torrent file",
"version": "0.2.2",
"project_urls": {
"Homepage": "https://github.com/iw4p/torrentp"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "6ab02a6a62b049f5e4742d4297f929868916454cc464955ea8807661f2057717",
"md5": "1d2f0b7a22a32271b3486493bb90397e",
"sha256": "f1934fc8d4aeab4bbec87154d9feffac65b03110466133e7503494f2bb41af44"
},
"downloads": -1,
"filename": "torrentp-0.2.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "1d2f0b7a22a32271b3486493bb90397e",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 10819,
"upload_time": "2024-04-03T08:30:28",
"upload_time_iso_8601": "2024-04-03T08:30:28.940446Z",
"url": "https://files.pythonhosted.org/packages/6a/b0/2a6a62b049f5e4742d4297f929868916454cc464955ea8807661f2057717/torrentp-0.2.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "1b1986f2f111b68a0d24c19c5b0ef51517be74a183aa9076f4421cff36bf9b1e",
"md5": "c5e4f34e84063add33a0e1ef0b4ea7d0",
"sha256": "30649b9f15fea8d1ff4137b335c282021d7dd5ea125f877bdff2b2bd88227c3d"
},
"downloads": -1,
"filename": "torrentp-0.2.2.tar.gz",
"has_sig": false,
"md5_digest": "c5e4f34e84063add33a0e1ef0b4ea7d0",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 10716,
"upload_time": "2024-04-03T08:30:30",
"upload_time_iso_8601": "2024-04-03T08:30:30.565412Z",
"url": "https://files.pythonhosted.org/packages/1b/19/86f2f111b68a0d24c19c5b0ef51517be74a183aa9076f4421cff36bf9b1e/torrentp-0.2.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-04-03 08:30:30",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "iw4p",
"github_project": "torrentp",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "torrentp"
}