Skip to main content

py3-wget

A Python library for downloading files of any size, especially optimized for large file downloads, with support for progress bars, checksum verification, timeout handling, and automatic retry on failed downloads.

Features

  • 🚀 Optimized for large file downloads
  • 📊 Progress bar visualization (optional)
  • 🔄 Automatic retry on failed downloads
  • 🔍 Optional integrity checks (cksum, MD5, SHA256)
  • ⏱️ Configurable timeout and retry settings
  • 🛡️ Safe file handling, optional overwrite
  • 📦 Simple and intuitive API
  • 💻 Cross-platform compatibility (works on any OS)

Installation

pip install py3-wget

Quick Start

Basic Download

from py3_wget import download_file

# Simple download with progress bar
download_file("https://raw.githubusercontent.com/python/cpython/3.11/LICENSE")

Basic Download Demo

Advanced Usage

Retry on Failure

The library automatically retries failed downloads with exponential backoff:

download_file(
    "https://raw.githubusercontent.com/python/cpython/3.11/LICENSE",
    max_tries=5,  # Maximum number of retry attempts
    retry_seconds=2  # Initial retry delay in seconds
)

Checksum Verification

Verify downloaded files using checksums:

download_file(
    "https://raw.githubusercontent.com/python/cpython/3.11/LICENSE",
    md5="fcf6b249c2641540219a727f35d8d2c2",  # MD5 checksum
    sha256="3aff1954277c4fc27603346901e4848b58fe3c8bed63affe6086003dd6c2b9fe"  # SHA256 checksum
)

Checksum Verification Demo

File Overwrite Control

download_file(
    "https://raw.githubusercontent.com/python/cpython/3.11/LICENSE",
    output_path="downloads/test.bin",
    overwrite=True  # Overwrite existing file
)

Overwrite Demo

API Reference

download_file

download_file(
    url: str,
    output_path: Optional[Union[str, Path]] = None,
    overwrite: bool = False,
    verbose: bool = True,
    cksum: Optional[int] = None,
    md5: Optional[str] = None,
    sha256: Optional[str] = None,
    max_tries: int = 5,
    block_size_bytes: int = 8192,
    retry_seconds: Union[int, float] = 2,
    timeout_seconds: Union[int, float] = 60,
) -> None

Parameters

  • url (str): URL of the file to download
  • output_path (str or Path, optional): Path to save the file. If None, derived from URL
  • overwrite (bool): Overwrite existing file (default: False)
  • verbose (bool): Show progress bar and messages (default: True)
  • cksum (int, optional): Expected checksum value
  • md5 (str, optional): Expected MD5 hash
  • sha256 (str, optional): Expected SHA256 hash
  • max_tries (int): Maximum retry attempts (default: 5)
  • block_size_bytes (int): Download block size in bytes (default: 8192)
  • retry_seconds (int/float): Initial retry delay in seconds (default: 2)
  • timeout_seconds (int/float): Download timeout in seconds (default: 60)

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Metadata

Release files for py3-wget 1.0.13

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

Source distribution (sdist)

Source distribution for py3-wget 1.0.13
File Size Uploaded
py3_wget-1.0.13.tar.gz 13.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for py3-wget 1.0.13
File Interpreter ABI Platform
py3_wget-1.0.13-py3-none-any.whl Python 3 none any Details

Total release size: 24.6 kB

Release files / py3_wget-1.0.13.tar.gz

Download URL py3_wget-1.0.13.tar.gz
Size 13.0 kB
Tags Source
SHA-256 checksum
How to use checksums
036e19e6dd5a766ca15c5400a6d2150227dd2a0090852e99ac58cb27977bd833
BLAKE2b-256 checksum
How to use checksums
ebb133b716985b9e691737e9697849bbbb265df96bef2f247cafb95207cdb84c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.11.13

Release files / py3_wget-1.0.13-py3-none-any.whl

Download URL py3_wget-1.0.13-py3-none-any.whl
Size 11.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9393efef98d5ec3a5c8e1518b415f70c299f820d54121cf56955006f09a5db83
BLAKE2b-256 checksum
How to use checksums
4722bd577aa6743cd14a8fedd0cea0f3847ba9526a14119425b273b02a77fd5c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.11.13

Release history Release notifications | RSS feed

This release

1.0.13 This release

2 release files

1.0.12

2 release files

1.0.11

2 release files

1.0.10

2 release files

1.0.8

2 release files

1.0.6

2 release files

1.0.5

2 release files

1.0.4

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

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