Skip to content

Scraper

omniread.csv.scraper

Summary

CSV scraper for OmniRead.

This module defines the scraper responsible for acquiring raw comma-separated-value document content from a backing store via a configured client.

The scraper does not interpret or parse the acquired bytes; it wraps them in the canonical Content model.

Classes

CsvScraper

CsvScraper(*, client: BaseCsvClient)

Scraper for csv documents.

Notes

Responsibilities:

1
2
3
- Fetch raw csv bytes via the configured client.
- Wrap the payload in a canonical `Content` instance with the
  CSV content type and source identifier.

Constraints:

1
2
- The scraper does not perform parsing or interpretation.
- Does not assume a specific storage backend.

Initialize the CSV scraper.

Parameters:

Name Type Description Default
client BaseCsvClient

Client responsible for retrieving raw csv bytes.

required
Functions
fetch
1
2
3
4
5
fetch(
    source: Any,
    *,
    metadata: Mapping[str, Any] | None = None
) -> Content

Fetch a csv document from the given source.

Parameters:

Name Type Description Default
source Any

Identifier of the csv source as understood by the configured client.

required
metadata Optional[Mapping[str, Any]]

Optional metadata to attach to the returned content.

None

Returns:

Name Type Description
Content Content

A Content instance containing raw csv bytes, source identifier, CSV content type, and optional metadata.

Raises:

Type Description
Exception

Retrieval-specific errors raised by the client.