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.2.tar.gz (115.4 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.2-py3-none-any.whl (82.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: websource-0.1.2.tar.gz
  • Upload date:
  • Size: 115.4 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.2.tar.gz
Algorithm Hash digest
SHA256 d5971f8684d5c41e5e7d010c3c18d72986c11a613f64469dbd19ed21bb408a15
MD5 b8b6cbfa18ae694f2b809ab903379943
BLAKE2b-256 20d36b2d98abdef0f4dd1393a63827f05e28fa223a91c645d00de0a09a08dd16

See more details on using hashes here.

Provenance

The following attestation bundles were made for websource-0.1.2.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.2-py3-none-any.whl.

File metadata

  • Download URL: websource-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 82.4 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 9d9069f6c401e026cf941618243ae7a02e5f0044addaccfff6438247bd9ff150
MD5 82de7ef4bf64778cbf7729e72296b015
BLAKE2b-256 c1f31686d4a015753ff38b4abdcbe9381ae5de81816fb4e6ebf9826705e1d753

See more details on using hashes here.

Provenance

The following attestation bundles were made for websource-0.1.2-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