Skip to main content

Minimal pagedigest consumer reference implementation

Project description

Python Consumer (Minimal Reference)

Install (from repo)

cd implementations/python-consumer
uv sync
uv pip install -e .

Requires Python ≥3.9. Runtime dependency: requests.

API

  • fetch — fetch and validate manifest; graceful fallback on errors
  • diff — compare manifest to cached site_rev / per-URL rev
  • audit — identity-encoding digest check (streams the body with a size cap)
  • check_sitefetch + diff + optional sampled audit plan
  • verify_live — fetch a manifest and sample live identity-encoded responses for digest verification
  • identity_digest — stream-hash a stream=True response body, capped at max_bytes, for custom audit pipelines
  • validate_manifest, resolve_url_key, manifest_url — validation and URL helpers
  • format_state_header, parse_state_header — strict optional PageDigest-State helpers

CLI

pagedigest verify-live https://example.com --sample-size 25

verify-live exits 2 on digest mismatches so it can act as a deployment gate. Redirects, network errors, and body-size caps are reported as inconclusive.

Example

from pagedigest import check_site

decision = check_site(
    "https://example.com",
    cached_site_rev=12,
    cached_revs={"/": 3, "/about": 1},
    sample_audit_rate=0.01,
)

After a successful manifest check, an integration may make its observed state visible on subsequent page requests:

from pagedigest import format_state_header

headers = {
    "PageDigest-State": format_state_header(
        decision["manifest"]["site_rev"],
        "/.well-known/pagedigest.json",
    )
}

This is a corroborating observation signal, not authentication. See SPEC.md §5.4.

Conformance fixtures: tests/test_vectors.py exercises ../../test-vectors/.

Persistent cache example

uv run python examples/cache_persistence.py https://example.com ./pagedigest-cache.json

The example stores site_rev, per-URL rev, ETag, and Last-Modified between runs. It prints page fetch decisions so crawler/indexer integrations can replace the print calls with their own fetch pipeline.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pagedigest-0.1.0.tar.gz (15.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pagedigest-0.1.0-py3-none-any.whl (10.2 kB view details)

Uploaded Python 3

File details

Details for the file pagedigest-0.1.0.tar.gz.

File metadata

  • Download URL: pagedigest-0.1.0.tar.gz
  • Upload date:
  • Size: 15.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for pagedigest-0.1.0.tar.gz
Algorithm Hash digest
SHA256 9f68cac82aacba910dab4695f4c7b2b0a9b234d8d9cb430b680629c2f5d00a55
MD5 04097484af17273c69d74c594fa9f1ba
BLAKE2b-256 ca11dfb5eca656956a82abf5f77755349c6f6943c13589e0658ee1e20f1a9d55

See more details on using hashes here.

Provenance

The following attestation bundles were made for pagedigest-0.1.0.tar.gz:

Publisher: publish-python.yml on maxwellsantoro/pagedigest

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pagedigest-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: pagedigest-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 10.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for pagedigest-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 56eced6ac1215d07db2074fd3a7773b6974ef062d5e4ad3e15d7b562472d97d5
MD5 f2bd6adef9cc65580f667e573d3e3e62
BLAKE2b-256 1340eb7c6513bec2eb9eada5b33418f5e047fe8862b97a6d4ebd3694ddcf84a7

See more details on using hashes here.

Provenance

The following attestation bundles were made for pagedigest-0.1.0-py3-none-any.whl:

Publisher: publish-python.yml on maxwellsantoro/pagedigest

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page