Waybackpy

3.0.6 · active · verified Thu Apr 09

Waybackpy is a Python package and command-line tool that interfaces with the Internet Archive's Wayback Machine APIs. It provides functionalities to archive web pages and retrieve various archived versions easily. The library is actively maintained, with the current version being 3.0.6, and has a consistent release cadence.

Warnings

Install

Imports

Quickstart

Demonstrates how to use the `WaybackMachineSaveAPI` to save a URL to the Internet Archive's Wayback Machine. A descriptive User-Agent is highly recommended.

import os
from waybackpy import WaybackMachineSaveAPI

url = "https://www.example.com"
# Use a descriptive User-Agent for better API interaction
user_agent = os.environ.get('WAYBACKPY_USER_AGENT', 'MyCustomApp (https://mycustomapp.com)')

save_api = WaybackMachineSaveAPI(url, user_agent)
try:
    archive_url = save_api.save()
    print(f"Page archived successfully: {archive_url}")
except Exception as e:
    print(f"Error archiving page: {e}")

view raw JSON →