Skip to main content

pyhaul

CI codecov PyPI License: MIT Docs

Resumable HTTP downloads for Python. Bring your own client: pyhaul borrows your existing session and handles byte-range negotiation, crash-safe checkpointing, and validation.

httpx niquests aiohttp requests urllib3

Install pyhaul from PyPI — pick the extra matching your HTTP client:

pip install pyhaul[httpx]   # or: niquests, requests, urllib3, aiohttp, wreq
import httpx
from pathlib import Path
from pyhaul import haul, PartialHaulError

dest = Path("big.zip")
with httpx.Client() as client:
    for _ in range(10):
        try:
            result = haul("https://example.com/big.zip", client, dest=dest)
            break
        except PartialHaulError:
            pass  # only retryable error; others propagate

print(f"done: {dest.stat().st_size:,} bytes")

What is it?

A small, pure-Python library that makes HTTP downloads resumable. Call haul() with a URL, your existing HTTP client, and a destination path. pyhaul handles byte-range negotiation, ETag validation, crash-safe checkpointing, and atomic file completion. Supports both sync and async across multiple HTTP client libraries.

Each call to haul() upholds these guarantees:

  • One haul() makes one request. You are responsible for retry loops, but retry just means call haul() again.
  • The destination file will not exist until download is complete. Incomplete data lives in a temporary .part file; on completion it is atomically moved into place.
  • Interrupted downloads resume when possible. Checkpoint state lives on disk, not in memory. Kill the process, lose the network, get a 503 — the next haul() picks up from the last durable byte.
  • If the remote resource changes, retry will not corrupt. ETag mismatch detection prevents gluing mismatched halves together.
  • Your HTTP client is borrowed, not owned. pyhaul sets per-request headers and returns your session untouched.
  • Transport errors pass through unwrapped. httpx.ReadTimeout stays httpx.ReadTimeout. You catch the types you already know.

No hard dependency on any HTTP library. Pick one (or several) as extras.

Documentation

Full documentation — Quick start, guides, and API reference.

Metadata

Release files for pyhaul 1.0.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 pyhaul 1.0.0
File Size Uploaded
pyhaul-1.0.0.tar.gz 147.3 kB Details

Built distribution (wheel)

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

Total release size: 220.1 kB

Release files / pyhaul-1.0.0.tar.gz

Download URL pyhaul-1.0.0.tar.gz
Size 147.3 kB
Tags Source
SHA-256 checksum
How to use checksums
92f292daedda4a004b95a963d3fd5f70ff72c15fdbf89c6f5eae72ae25b73c1e
BLAKE2b-256 checksum
How to use checksums
9df32d9fe0a2f4d0fdeb3c197c2fbd214c6109853e7ce74bf916d4b726d137fa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.17 {"installer":{"name":"uv","version":"0.12.17","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 15, 2026.

Transparency log

Release files / pyhaul-1.0.0-py3-none-any.whl

Download URL pyhaul-1.0.0-py3-none-any.whl
Size 72.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9dd4ed6f73787685180772d862d4896a8460dbf37d44c843e4656beb745be933
BLAKE2b-256 checksum
How to use checksums
daef970e530a88821360f446a8adcb78e07366ab4f825f805ce63c0902e01cc8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.17 {"installer":{"name":"uv","version":"0.12.17","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 15, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files

0.8.0

2 release files

0.7.1

2 release files

0.7.0

2 release files

0.6.1

2 release files

0.5.0

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.0

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