Skip to main content

auto-download

A simple, efficient, general-purpose Python multithreaded download library.

Installation

pip install autoDownload

Usage

Basic Usage

In Program

import autoDownload

taskConfig = autoDownload.TaskConfig(
    url='https://example.com/', # download url
    file='example.zip', # save path
    method='GET', # download method, default is 'GET'
    headers={'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.142.86 Safari/537.36'}, # download headers, default is {}
    **kwargs
)

# It will block the current thread until it completes
autoDownload.request(taskConfig)

# It will return an awaitable object (see https://docs.python.org/3.13/library/asyncio-task.html#awaitables), which is useful in asynchronous programming
autoDownload.asyncRequest(taskConfig)

# It will return nothing, and when it completes, the callback function will be called. This is useful in functional programming
autoDownload.callbackRequest(taskConfig, callback)

In Command Line

auto-download [-h] [-f FILE] [-m MAX] [-r RETRY] [-H HEADER] Url

For more information, see:

auto-download -h

Advanced Usage

Customize how tasks are waiting

# It will return a TaskResult object.
res=autoDownload.rawRequest(taskConfig)

# res.event is a threading.Event object, which can be used to wait for the task to complete.
res.event.wait()

# res.ok is a bool object, which indicates whether the task was successful.
if res.ok:
    # res.task is a autoDownload.download.Task object, which is the main controller for the task.
    print(f"Task{res.task.identity} completed successfully!")

else:
    # res.err is a TaskError object, which indicates the reason for the failure.
    raise res.err

Customize the threading pool or the adapter

# You can customize almost everything in the threading pool or the adapter
adapter=autoDownload.adapters.Adapter()
pool=autoDownload.pools.Pool(maxThread=10, adapter=adapter)
unit=autoDownload.unit.Unit(pool)

unit.request(taskConfig)

Show the progress of the download in the command line

progress=autoDownload.progress.DownloadProgress(
    task1, task2, task3,
    showTotal=True, # show the total progress
    showParts=True, # show the progress of each part
    showMerge=True, # show the progress of the merge
)
with progress:
    while True:
        progress.refresh()
        time.sleep(0.5)

License

The Project is released under the Mulan Public License 2.0.

Metadata

Release files for autoDownload 0.1.2

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

Source distribution (sdist)

Source distribution for autoDownload 0.1.2
File Size Uploaded Provenance Actions
autodownload-0.1.2.tar.gz 19.2 kB Without provenance Details for autodownload-0.1.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for autoDownload 0.1.2
File Interpreter ABI Platform Actions
autoDownload-0.1.2-py3-none-any.whl Python 3 none any Details for autoDownload-0.1.2-py3-none-any.whl

Total release size: 39.6 kB

Release files / autodownload-0.1.2.tar.gz

Download URL autodownload-0.1.2.tar.gz
Size 19.2 kB
Tags Source
SHA-256 checksum
How to use checksums
d3bd67dafc719f19bdbbe498f7088f537d1d8e7270cecd4a46de693adeba6e99
BLAKE2b-256 checksum
How to use checksums
bf671934aafdb7a4206db7633233cda109a96b94ce38b607f5eeba1116bc2612
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.12.8

Release files / autoDownload-0.1.2-py3-none-any.whl

Download URL autoDownload-0.1.2-py3-none-any.whl
Size 20.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2369cd392ac4ef5fd8e06a062df211394afb5bb672819d9295b79760210e9efb
BLAKE2b-256 checksum
How to use checksums
7abfcce2a0a00437c3f5de04392ca4a5a8901a31ac045493347b68bd93fb1c61
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.12.8

Security for autoDownload 0.1.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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