A HTTP and FTP parallel file downloader.
Project description
A parallel file downloader using asyncio. parfive can handle downloading multiple files in parallel as well as downloading each file in a number of chunks.
Usage
parfive works by creating a downloader object, appending files to it and then running the download. parfive has a synchronous API, but uses asyncio to paralellise downloading the files.
A simple example is:
from parfive import Downloader
dl = Downloader()
dl.enqueue_file("http://data.sunpy.org/sample-data/predicted-sunspot-radio-flux.txt", path="./")
files = dl.download()
Parfive also bundles a CLI. The following example will download the two files concurrently.:
$ parfive 'http://212.183.159.230/5MB.zip' 'http://212.183.159.230/10MB.zip'
$ parfive --help
usage: parfive [-h] [--max-conn MAX_CONN] [--overwrite] [--no-file-progress]
[--directory DIRECTORY] [--print-filenames]
URLS [URLS ...]
Parfive, the python asyncio based downloader
positional arguments:
URLS URLs of files to be downloaded.
optional arguments:
-h, --help show this help message and exit
--max-conn MAX_CONN Number of maximum connections.
--overwrite Overwrite if the file exists.
--no-file-progress Show progress bar for each file.
--directory DIRECTORY
Directory to which downloaded files are saved.
--print-filenames Print successfully downloaded files's names to stdout.
Results
parfive.Downloader.download returns a parfive.Results object, which is a list of the filenames that have been downloaded. It also tracks any files which failed to download.
Handling Errors
If files fail to download, the urls and the response from the server are stored in the Results object returned by parfive.Downloader. These can be used to inform users about the errors. (Note, the progress bar will finish in an incomplete state if a download fails, i.e. it will show 4/5 Files Downloaded).
The Results object is a list with an extra attribute errors, this property returns a list of named tuples, where these named tuples contains the .url and the .response, which is a aiohttp.ClientResponse or a aiohttp.ClientError object.
Installation
parfive is available on PyPI, you can install it with pip:
pip install parfive
or if you want to use FTP downloads:
pip install parfive[ftp]
Requirements
Python 3.9 or above
aiohttp
tqdm
aioftp (for downloads over FTP)
Licence
MIT Licensed
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file parfive-2.3.1.tar.gz.
File metadata
- Download URL: parfive-2.3.1.tar.gz
- Upload date:
- Size: 40.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
70bf6f4cbdb62e7df07e13dddc74bbb85a76efb8b38c0522bc63aa94a2270a78
|
|
| MD5 |
9e20d421325bb9a827ca9405614f18df
|
|
| BLAKE2b-256 |
ed7aa3b0ec6b038d2b2e83913bfc69debf42339112cd03ce3b32896c78990474
|
Provenance
The following attestation bundles were made for parfive-2.3.1.tar.gz:
Publisher:
ci_workflows.yml on Cadair/parfive
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
parfive-2.3.1.tar.gz -
Subject digest:
70bf6f4cbdb62e7df07e13dddc74bbb85a76efb8b38c0522bc63aa94a2270a78 - Sigstore transparency entry: 863020157
- Sigstore integration time:
-
Permalink:
Cadair/parfive@98e19bee779dfe71982cf7cfc3e4651eb7e2febe -
Branch / Tag:
refs/tags/v2.3.1 - Owner: https://github.com/Cadair
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci_workflows.yml@98e19bee779dfe71982cf7cfc3e4651eb7e2febe -
Trigger Event:
push
-
Statement type:
File details
Details for the file parfive-2.3.1-py3-none-any.whl.
File metadata
- Download URL: parfive-2.3.1-py3-none-any.whl
- Upload date:
- Size: 34.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
97baec7e2ff90608ba22393e0ea84c3c931005f8a1c571644081c4a3b347b086
|
|
| MD5 |
9ce79b30ce55b0542879cb1ecfb2fda6
|
|
| BLAKE2b-256 |
e9c677257a6fd4fda7a360fd409eed9be27ddc1071b16d481784be86b2d59907
|
Provenance
The following attestation bundles were made for parfive-2.3.1-py3-none-any.whl:
Publisher:
ci_workflows.yml on Cadair/parfive
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
parfive-2.3.1-py3-none-any.whl -
Subject digest:
97baec7e2ff90608ba22393e0ea84c3c931005f8a1c571644081c4a3b347b086 - Sigstore transparency entry: 863020182
- Sigstore integration time:
-
Permalink:
Cadair/parfive@98e19bee779dfe71982cf7cfc3e4651eb7e2febe -
Branch / Tag:
refs/tags/v2.3.1 - Owner: https://github.com/Cadair
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci_workflows.yml@98e19bee779dfe71982cf7cfc3e4651eb7e2febe -
Trigger Event:
push
-
Statement type: