Registry / http-networking / waybackpy

waybackpy

JSON →
library3.0.6pypypi✓ verified 25d ago

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.

pip install waybackpy
INSTALL
IMPORT
SIG · WAYBACKPY
W
waybackpy
http-networkingpythonv3.0.6
Install
2.4s avg
Import
372ms
Disk
20MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v3.0.6 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.390s · 22.2MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 2.4s · import 0.354s · 23MB
20MB installed
● package 20MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

WaybackMachineSaveAPI
from waybackpy import WaybackMachineSaveAPI
Recommended class for saving URLs to the Wayback Machine.
WaybackMachineCDXServerAPI
from waybackpy import WaybackMachineCDXServerAPI
Recommended class for interacting with the CDX Server API to retrieve snapshots.
Url
from waybackpy import Url
import waybackpy.Url
The 'Url' class is still supported but the specialized API classes (e.g., WaybackMachineSaveAPI) are recommended for new development since v3.0.0. Older versions might directly expose functions like `waybackpy.save()` without explicit class instantiation.

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}")
waybackpy --version
Debug
Known issues
breakingPython 3.5 and older are no longer supported. Version 3.0.3 dropped support for Python 3.4-3.6, though Python 3.6 support was later restored in version 3.0.5. The library now explicitly requires Python >= 3.6.
fix
Upgrade to Python 3.6 or newer.
affects: >=3.0.3, <3.0.5 for Python 3.6; >=3.0.3 for Python 3.5 and below
deprecatedThe `get()` method, which was previously used to retrieve the source code of a webpage, was deprecated in version 3.0.0. This method was considered a poor fit for the library's scope.
fix
For retrieving archived page content, use the appropriate methods within the `WaybackMachineCDXServerAPI` or `Url` class for finding an archive, and then an HTTP client (like `requests`) to fetch the content from the returned archive URL.
affects: >=3.0.0
gotchaStarting from version 3.0.0, Waybackpy introduced dedicated classes for each of the three main Wayback Machine APIs: `WaybackMachineSaveAPI`, `WaybackMachineCDXServerAPI`, and `WaybackMachineAvailabilityAPI`. While the older `Url` class remains functional for backward compatibility, new development should leverage these specialized classes for better clarity and access to specific API features.
fix
Refactor code to use the specific API classes (e.g., `WaybackMachineSaveAPI` for saving, `WaybackMachineCDXServerAPI` for CDX queries) instead of relying solely on the generic `Url` class.
affects: >=3.0.0
gotchaThe Internet Archive recommends against using the `WaybackMachineAvailabilityAPI` due to potential performance issues. Its functionality is largely covered by the `WaybackMachineCDXServerAPI`.
fix
Prefer `WaybackMachineCDXServerAPI` for checking archive availability and retrieving archive metadata.
affects: All versions
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'waybackpy'
The waybackpy package is not installed in the Python environment where the script is being executed.
fix
pip install waybackpy
AttributeError: module 'waybackpy' has no attribute 'WaybackMachine'
The WaybackMachine class is attempted to be accessed directly from the waybackpy module after a simple import, instead of being imported specifically.
fix
from waybackpy import WaybackMachine
requests.exceptions.ConnectionError
The script failed to establish a network connection to the Wayback Machine servers, often due to internet connectivity issues, firewalls, or incorrect proxy settings.
fix
Check your internet connection, firewall rules, and proxy settings to ensure that outgoing requests to the Internet Archive's servers are not blocked.
waybackpy.exceptions.WaybackpyRateLimitError
The client has exceeded the rate limits imposed by the Internet Archive's Wayback Machine API, leading to a temporary block on further requests.
fix
Wait for some time before making further requests, or implement a delay between consecutive requests, possibly using the 'interval_between_tries' parameter in methods like 'save_page'.
Upgrade
Version history
3.0.6latest on PyPI · released Mar 15, 2022
Audit
Dependencies
requestsrequiredUsed for making HTTP requests to the Wayback Machine APIs.
Agent activity
31 hits · last 30 days
node
26
OpenAI (training)
1
Resources
waybackpy — pip install waybackpy · libregistry