Skip to main content

Parallel Media Downloader

Test Test Coverage Maintainability Code Climate technical debt Updates PyPI - Python Version PyPI - Downloads Twitter URL

Helps you to download media file in parallel without async / await syntax.

Feature

This project helps you to download media files in parallel without async / await syntax.

Installation

pip install parallelmediadownloader

Usage

Minimum example:

from datetime import datetime

from parallelmediadownloader.media_download_coroutine import DownloadOrder
from parallelmediadownloader.media_file import SaveOrder
from parallelmediadownloader.parallel_media_downloader import ParallelMediaDownloader

path_directory_download = "path/directory/download"
created_date_time = datetime.now()
list_download_order = [
    DownloadOrder(
        "https://example.com/test01.png",
        SaveOrder(
            path_directory_download,
            "test01.png",
            created_date_time,
        ),
    ),
    DownloadOrder(
        "https://example.com/test02.png",
        SaveOrder(
            path_directory_download,
            "test02.png",
            created_date_time,
        ),
    ),
    DownloadOrder(
        "https://example.com/test03.png",
        SaveOrder(
            path_directory_download,
            "test03.png",
            created_date_time,
        ),
    ),
]
list_media_download_result = ParallelMediaDownloader.execute(list_download_order)

API

ParallelMediaDownloader.execute

class ParallelMediaDownloader:
    """API of parallel media downloading."""

    @staticmethod
    def execute(
        list_download_order: Iterable[DownloadOrder],
        *,
        limit: int = 5,
        media_filter: Optional[MediaFilter] = None,
        allow_http_status: List[int] = None
    ) -> List[MediaDownloadResult]:

list_download_order: Iterable[DownloadOrder]

List of DownloadOrder. Method will download them in parallel.

limit: int = 5

Limit number of parallel processes.

media_filter: Optional[MediaFilter] = None

Filter extends MediaFilter to remove downloaded media file depending on file or content of media. NotImageFilter will be help to understand its roll:

class NotImageFilter(MediaFilter):
    def _filter(self, media_file: MediaFile) -> bool:
        return not str(media_file.path_file).lower().endswith((".png", ".jpg", ".jpeg", ".gif"))

allow_http_status: List[int] = None

By default, ParallelMediaDownloader.execute will check HTTP status code by Response.raise_for_status and whole process will stop. When HTTP status applies allow_http_status, process will continue. Then, MediaDownloadResult.media_file will be None.

Metadata

Release files for parallelmediadownloader 0.2.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 parallelmediadownloader 0.2.0
File Size Uploaded Provenance Actions
parallelmediadownloader-0.2.0.tar.gz 14.0 kB Without provenance Details for parallelmediadownloader-0.2.0.tar.gz

Built distribution (wheel)

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

Total release size: 24.6 kB

Release files / parallelmediadownloader-0.2.0.tar.gz

Download URL parallelmediadownloader-0.2.0.tar.gz
Size 14.0 kB
Tags Source
SHA-256 checksum
How to use checksums
e06935e3afac79b56b6a39ed4ef1cb2c6c1cb53772e6aa051e49954014d2e105
BLAKE2b-256 checksum
How to use checksums
c26e16c7345d6ff631db8a031ac4bb4ad7ada916a3a361ca6b723af832e12fea
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / parallelmediadownloader-0.2.0-py3-none-any.whl

Download URL parallelmediadownloader-0.2.0-py3-none-any.whl
Size 10.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
377718f882099c394a20bcde066afa22a4e35674435108e2c220c4b37542b3e6
BLAKE2b-256 checksum
How to use checksums
e225e37e6712fac7cb4c6b4c566cbef27cfe7c1f489213984f8e3ee5823eb3e8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Security for parallelmediadownloader 0.2.0

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