Skip to main content

Archivist

PyPI version Supported Python versions Build status Coverage report PyPI downloads

Archive webpages and files with a typed Python API.

Python clients for Internet Archive and Archive.today, with synchronous and asynchronous APIs.

Features

  • Search Internet Archive's Wayback capture history
  • Save pages through Internet Archive's Save Page Now service
  • Upload files to Internet Archive, recover interrupted transfers, and request item removal
  • Check capture progress, service availability, and account capacity
  • Browse Archive.today history and find first, latest, or closest captures
  • Use the same models from synchronous and asynchronous code
  • Keep credentials and sensitive URL data out of representations and logs

Installation

Archivist requires Python 3.11 or later.

uv add archivist-py

Using pip:

pip install archivist-py

Internet Archive

Find the oldest Wayback Machine capture without an account:

from archivist import (
    InternetArchiveCdxRecord,
    InternetArchiveCdxResult,
    InternetArchiveClient,
)

with InternetArchiveClient() as client:
    captures: InternetArchiveCdxResult = client.search("https://example.com/", limit=1)

oldest: InternetArchiveCdxRecord | None = next(iter(captures), None)
if oldest is not None:
    print(f"{oldest.timestamp:%Y-%m-%d}: {oldest.archive_url()}")

Save a page anonymously and wait for the finished capture in one call:

from archivist import InternetArchiveClient, InternetArchiveSuccessStatus

with InternetArchiveClient() as client:
    capture: InternetArchiveSuccessStatus = client.save("https://example.com/")

print(capture.archive_url())

Credentials are optional for the Wayback examples above. Provide them for account features and restricted save options such as screenshots, emailed results, and WACZ files.

Upload a file to a new Internet Archive item using your account:

from pathlib import Path

from archivist import (
    InternetArchiveAccount,
    InternetArchiveClient,
    InternetArchiveUploadOptions,
)

account = InternetArchiveAccount("you@example.com", "your-password")
options = InternetArchiveUploadOptions(
    identifier="your-unique-item-id",
    title="Project notes",
    description="Notes from my project.",
    subjects=["notes"],
)
with InternetArchiveClient(account=account) as client:
    result = client.upload(Path("notes.txt"), options)

print(result.details_url)

Uploads are create-only. Interrupted transfers can be reconciled with get_item() and recovered explicitly with add_files() after exact ownership, provenance, filename, size, MD5, and SHA-1 checks. For upload recovery, options, and item removal, see the Internet Archive guide.

Archive.today

Find the oldest Archive.today capture through its Memento interface:

from archivist import ArchiveTodayClient, ArchiveTodayMemento

with ArchiveTodayClient() as client:
    oldest: ArchiveTodayMemento | None = client.first("https://example.com/")

if oldest is not None:
    print(f"{oldest.archived_at:%Y-%m-%d}: {oldest.archive_url}")

Archivist can browse existing Archive.today captures, but cannot create new ones because the service's bot protection prevents reliable automated access.

Async Support

Async clients mirror the synchronous API. Use AsyncInternetArchiveClient or AsyncArchiveTodayClient with async with, then await the same operations.

Documentation

Read the full documentation for authentication, save options, async examples, error handling, and the complete API reference.

Metadata

Release files for archivist-py 1.3.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 archivist-py 1.3.0
File Size Uploaded
archivist_py-1.3.0.tar.gz 66.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for archivist-py 1.3.0
File Interpreter ABI Platform
archivist_py-1.3.0-py3-none-any.whl Python 3 none any Details

Total release size: 144.0 kB

Release files / archivist_py-1.3.0.tar.gz

Download URL archivist_py-1.3.0.tar.gz
Size 66.2 kB
Tags Source
SHA-256 checksum
How to use checksums
ada7864d43e42f805bcc63c11ccbe026995f4d26c4a3e0117d32ba3f56dd567c
BLAKE2b-256 checksum
How to use checksums
4b449d9f69ac166c5bfe219297e01c96b4af73f3c810ea2af87596fffc1fabe5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.19 {"installer":{"name":"uv","version":"0.12.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / archivist_py-1.3.0-py3-none-any.whl

Download URL archivist_py-1.3.0-py3-none-any.whl
Size 77.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0b452f216c899417741c7e6878fb5878ceb45dc6d3dc20b8952d961fe71a9ed1
BLAKE2b-256 checksum
How to use checksums
1710f3b2f792d4918ba65544796a54d9c38bbb1b18a56587db19a8d910575149
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.19 {"installer":{"name":"uv","version":"0.12.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release history Release notifications | RSS feed

1.4.0

2 release files

This release

1.3.0 This release

2 release files

1.2.0

2 release files

1.1.0

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.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