$ show internetarchive/openlibrary-client
openlibrary-client is a reference Python client library for the Open Library API, maintained by the Internet Archive. It provides object-oriented models for books, authors, editions, works, and covers, wrapping the REST endpoints behind a simple client class. The library supports cookie-based authentication, read/fetch operations, and write operations such as creating new works and editions. It also includes utilities for parsing MARC dump lines and validating book import schemas, making it useful beyond simple API access.
The LLM identified 3 files worth highlighting for reuse:
Core OpenLibraryClient class that wraps the Open Library REST API. Handles base URL configuration, cookie-based authentication, JSON marshalling, and HTTP verbs. Demonstrates a clean repository-pattern wrapper around a REST API that can be extracted and reused in any project needing Open Library integration.
Parser for MARC record lines from Open Library dumps. Converts a single MARC line into structured JSON, extracting fields like title, author, and identifiers. This is a self-contained data-normalization component that could be reused in any MARC-to-JSON pipeline, not just Open Library.
Defines and validates the import schema for book metadata, including external identifiers and read-only field rules. Encodes domain rules about which fields are allowed in Open Library imports. The validation logic is reusable for any book-import pipeline that needs to enforce a consistent metadata schema.