Skip to main content

Typed policy-bounded contracts for Keble asynchronous scraping.

Project description

Keble Scraper Contract

keble-scraper-contract is the framework-free request, lifecycle, artifact, proxy, callback, and operator identity boundary for Keble's asynchronous scraper. Generic callers can submit only GET/HEAD public-resource requests. The sole POST exception is the registered, typed Shopify Storefront GraphQL profile; callers cannot supply GraphQL text, mutations, arbitrary headers, or credentials.

All values are immutable Pydantic v2 models, reject undeclared fields, serialize with camel-case aliases, and expose bounded enums instead of arbitrary TTLs or transport flags.

Version 0.2.0 replaces free-string attempt/job/callback failures with one discriminated contract:

  • ScrapeLocalFailure owns caller-auth, request-policy, runtime, capacity, and operator failures through a finite code/origin vocabulary;
  • ScrapeUpstreamFailure owns target-resource, paid-egress, and browser-provider failures with universal kind/disposition/action, exact capacity evidence, bounded native status/request identity, and optional retry time;
  • supplier payment is valid only for a paid supplier origin with reviewed documented-code or account-status evidence. A target 402, a rate limit, quarantine, or missing credential never implies payment;
  • attempts, terminal jobs, signed completion events, and HTTP errors use the same typed failure family. Success forbids failure evidence and every failed terminal state requires it.

The public wire uses ScrapeFailureEnvelope for non-success HTTP responses. The contract source/version guard compares src/ with the latest package-scoped annotated tag and rejects source drift under an existing version or metadata regression.

Side effects if changes:

  • scraper API, Shopify polling/callbacks, and frontend mappings must release in the same wave;
  • Data Infra may adapt upstream failures but must not reinterpret local failures as provider payment.
uv run --package keble-scraper-contract pytest -q keble-scraper-contract/tests
npx --yes pyright .
uv run python keble-scraper-contract/src/keble_scraper_contract/release_guard.py
uv build --package keble-scraper-contract

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

keble_scraper_contract-0.2.0.tar.gz (19.1 kB view details)

Uploaded Source

Built Distribution

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

keble_scraper_contract-0.2.0-py3-none-any.whl (19.5 kB view details)

Uploaded Python 3

File details

Details for the file keble_scraper_contract-0.2.0.tar.gz.

File metadata

  • Download URL: keble_scraper_contract-0.2.0.tar.gz
  • Upload date:
  • Size: 19.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.9 {"installer":{"name":"uv","version":"0.10.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for keble_scraper_contract-0.2.0.tar.gz
Algorithm Hash digest
SHA256 1064b5b807099ff1623c9503c866568f4ca883252b6affae33844266d8f88916
MD5 d1d055713eb4255263d72f811bd106a0
BLAKE2b-256 ac3fdbfb9cccda2e9726c290e3d816c594780c1b3550d353c56d7e521c810b9c

See more details on using hashes here.

File details

Details for the file keble_scraper_contract-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: keble_scraper_contract-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 19.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.9 {"installer":{"name":"uv","version":"0.10.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for keble_scraper_contract-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e143e201e34f261702112927f3c44c62120b7330c75fa407250d362561ca4c4d
MD5 b8df6ac85b833ed37c761cecea765a70
BLAKE2b-256 90940c095fd4709322e0ca6060a6d5a962f1f87ddea5471cc9fd5bcff58131aa

See more details on using hashes here.

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