libretexts.bulk_import

Attributes

CATALOG_API_URL

logger

plugin

Functions

_parse_records(items) → list[server.plugins.libretexts.libretexts_models.LibreTextsBook]

Validate raw API items, logging all malformed records together.

fetch_books([search, limit]) → list[server.plugins.libretexts.libretexts_models.LibreTextsBook]

Fetch books matching search from the LibreTexts Commons catalog API.

bulk_translate(books) → collections.abc.Iterator[server.plugins.ome_plugin.EducationResource]

Translate raw LibreTexts book dicts to OME EducationResource cards.

bulk_import([search, cache_path]) → list[dict]

Fetch LibreTexts books and return serialised OME records.

Module Contents

libretexts.bulk_import.CATALOG_API_URL = 'https://commons.libretexts.org/api/v1/commons/catalog'
libretexts.bulk_import.logger
libretexts.bulk_import.plugin
libretexts.bulk_import._parse_records(items: list) → list[server.plugins.libretexts.libretexts_models.LibreTextsBook]

Validate raw API items, logging all malformed records together.

async libretexts.bulk_import.fetch_books(search: str = 'Python', limit: int = 100) → list[server.plugins.libretexts.libretexts_models.LibreTextsBook]

Fetch books matching search from the LibreTexts Commons catalog API.

libretexts.bulk_import.bulk_translate(books: list[dict]) → collections.abc.Iterator[server.plugins.ome_plugin.EducationResource]

Translate raw LibreTexts book dicts to OME EducationResource cards.

libretexts.bulk_import.bulk_import(search: str = 'Python', cache_path: pathlib.Path | None = None) → list[dict]

Fetch LibreTexts books and return serialised OME records.

Results are cached locally so that repeated runs do not re-fetch the API.