Skip to main content

Standalone website discovery, fetching, parsing, and adapter contracts.

Project description

websource

Standalone website discovery, fetching, parsing, rendering, content extraction, structured extraction, refresh checking, and adapter contracts.

websource is built around strict Pydantic models and protocol interfaces. The foundation layer owns value objects, enums, request/result models, adapter descriptors, protocol interfaces, and error contracts. Runtime HTTP, browser, provider, and website-specific adapters sit outside websource.foundation.

Structured extraction is modeled separately from readable content extraction, so article markdown, recipes, product records, property listings, vehicle ads, jobs, events, and custom schemas can share one transport contract without forcing every page into an article-shaped model.

Install

pip install websource

Optional browser rendering uses Playwright:

pip install "websource[browser]"
python -m playwright install chromium

For local development:

uv sync --all-extras --group dev
uv run --group dev pytest

CLI

websource adapters list --json
websource inspect https://example.com --json
websource discover https://example.com --mode crawl --max-depth 1 --jsonl
websource fetch https://example.com --json
websource fixture replay tests/fixtures/sites/example.com/article.html --url https://example.com/articles/one --json
websource provider run tavily tavily-http https://api.tavily.example/extract extract --input-url https://example.com/article --param schema=article --json

The CLI emits JSON envelopes for validation and runtime errors so agents and automation can handle failures deterministically. inspect performs a shallow seed URL probe: robots facts and verified source hints stay in fields such as robots.sitemap_urls and sitemap_urls, while unverified conventional fallbacks are labeled as candidate_sitemap_urls. When no sitemap hint has been verified, sitemap_urls is null, not []. Use inspect --include-http-headers to append request and response headers for the HTTP exchanges made during inspection.

Python API

from websource.adapters import DefaultWebsiteClient
from websource.foundation import FetchRequest

client = DefaultWebsiteClient()
result = await client.fetch(FetchRequest(url="https://example.com"))
page = await client.parse_page(result)
content = await client.extract_content(page)

Custom adapters can subclass SiteSpecificAdapter and advertise only the capabilities they override. Managed providers can use HttpManagedProviderAdapter while provider-specific packages stabilize. Built-in vertical schemas are available through websource.schemas for recipes, products, property listings, vehicle listings, job postings, and events.

Release Checks

uv run --group dev ruff check src tests
uv run --group dev mypy src tests
uv run --group dev pytest
uv run --group dev bandit -r src
uv build
scripts/verify-package-install.sh

Documentation

License

MIT

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

websource-0.1.1.tar.gz (115.1 kB view details)

Uploaded Source

Built Distribution

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

websource-0.1.1-py3-none-any.whl (82.3 kB view details)

Uploaded Python 3

File details

Details for the file websource-0.1.1.tar.gz.

File metadata

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

File hashes

Hashes for websource-0.1.1.tar.gz
Algorithm Hash digest
SHA256 a4dbcca0579e16014d39951d7a257d3ed6890e3ce6d6e1a7b34273c539604d22
MD5 e9fbf8f6379c6ad0689bfa500150846b
BLAKE2b-256 72d1ab5e23523c709627712313bbd1c87ab47a0a06945a16a456b3a69ca0bcb1

See more details on using hashes here.

Provenance

The following attestation bundles were made for websource-0.1.1.tar.gz:

Publisher: publish.yml on romamo/websource

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

File details

Details for the file websource-0.1.1-py3-none-any.whl.

File metadata

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

File hashes

Hashes for websource-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 19f089ea6cb61d812118d1b2357be54c924285bdaae6aaa65b73b3ab4de46a76
MD5 fb02267a9b4505c391edf91994ea8717
BLAKE2b-256 49872b9e4fa6f3434a16b5f7836f9ae353535db55424f2b2d25999773abd8e82

See more details on using hashes here.

Provenance

The following attestation bundles were made for websource-0.1.1-py3-none-any.whl:

Publisher: publish.yml on romamo/websource

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