API reference
Generated from the source with mkdocstrings.
Client
bibliofabric.core.CoreClient
Client for the CORE API v3.
Requests work without a key at the small unauthenticated quota; set
api_key (or the CORE_API_KEY environment variable) to raise it.
The key travels as an Authorization: Bearer header.
works: WorksResource
cached
property
Search the works corpus and read single works.
outputs: OutputsResource
cached
property
Search the outputs corpus and read single outputs.
journals: JournalsResource
cached
property
Search the journals corpus and read single journals.
data_providers: DataProvidersResource
cached
property
Search the data providers and read their harvest stats.
discovery: DiscoveryResource
cached
property
Find full text links for repository deposits.
recommendations: RecommendationsResource
cached
property
Ask the recommender for a related record.
The sync twin CoreSyncClient mirrors the client method for method and
exports from the same module: from bibliofabric.core import CoreSyncClient.
Settings
bibliofabric.core.CoreSettings
CORE-specific client settings.
Inherits timeout, max_retries, max_retry_wait,
max_requests_per_second, max_concurrency, user_agent and
mailto from :class:bibliofabric.config.BaseApiSettings and sets
CORE defaults (0.15 requests per second, concurrency 1) for the
token-based quota the CORE API documents. Requests work without a key at
the small unauthenticated quota; a key raises it. Register at
https://core.ac.uk/services/api.
Resources
Each search resource inherits the generic operations from
bibliofabric.Resource (get, search, iterate, collect, first,
count). Only the members that the client adds or changes are shown here.
bibliofabric.core.WorksResource
Client for the /works endpoints and the works search.
stats(id: str | int) -> WorkStats
async
Return the harvest dates of one work.
outputs(id: str | int, *, on_error: OnError = 'raise', failures: list[ValidationError] | None = None) -> list[Output]
async
Return the outputs of one work: its version and source instances.
The published document describes the route both as a list and as a single Output, so either answer shape validates.
tei(id: str | int) -> Element
async
Return the TEI XML of the PDF associated with one work.
download(id: str | int, dest: Path | str, *, accept: str = 'application/pdf', output_format: str | None = None) -> Path
async
Download the file of one work to dest and return the path.
accept takes application/pdf or application/msword;
output_format takes tei, pdf, txt, or raw.
bibliofabric.core.OutputsResource
Client for the /outputs endpoints and the outputs search.
stats(id: str | int) -> OutputStats
async
Return the harvest dates of one output.
history(id: str | int, *, on_error: OnError = 'raise', failures: list[ValidationError] | None = None) -> list[Output]
async
Return the harvested OAI-PMH record versions of one output.
The published document describes the route both as a list and as a single Output, so either answer shape validates.
raw(id: str | int, dest: Path | str) -> Path
async
Save the raw harvested XML record of one output to dest.
download(id: str | int, dest: Path | str, *, output_format: str | None = None) -> Path
async
Download the file of one output to dest and return the path.
output_format takes the formats the download route serves, for
example pdf or tei.
bibliofabric.core.JournalsResource
Client for the /journals endpoints and the journals search.
stats(id: str | int) -> JournalStats
async
Return the record counts of one journal.
bibliofabric.core.DataProvidersResource
Client for the /data-providers endpoints and their search.
stats(id: str | int) -> DataProviderStats
async
Return the harvest counts and history of one data provider.
stats_history(id: str | int, *, deposit_history: bool = False, raw_stats: bool = False, set_name: str = '', refresh: bool = False) -> DataProviderStats
async
Return the harvest stats of one provider over its OAI set.
The POST variant of :meth:stats adds the deposit_history and
refresh controls the GET route does not carry. set_name
selects one OAI set of the provider's repository.
outputs(id: str | int, filters: Mapping[str, Any] | None = None, *, query: str = '', sort: str | None = None, page_size: int | None = None, page: int | None = None, on_error: OnError = 'raise', failures: list[ValidationError] | None = None, params: Mapping[str, Any] | None = None) -> Page[Output]
async
Search the outputs harvested from one data provider.
The route is the works-style simple search scoped to the provider
and documents a 10,000-result ceiling. sort is the raw route
value, which defaults to relevance upstream.
bibliofabric.core.DiscoveryResource
Client for the POST /discover full text finder.
The route answers the deposit metadata of a repository submission with the best full text link CORE can find for it.
find(*, doi: str, title: str = '', year: int | None = None, eprints_id: str = '', plugin_id: str = '', referrer: str = '') -> DiscoveryResult
async
Find the best full text link for one deposit.
doi is the match key of the route; the remaining fields are the
deposit metadata the published document marks as required, sent as
empty values when the caller does not have them.
bibliofabric.core.RecommendationsResource
Client for the POST /recommend recommender.
The route answers recommendation input with the recommended record; the published document types the answer as a single Output.
find(*, text: str = '', identifier: str = '', abstract: str = '', authors: Sequence[str] = (), title: str = '', result_type: str | None = None, data_provider_id: int | None = None, limit: int | None = None) -> Output
async
Return the record the recommender suggests for the given input.
identifier accepts a CORE id with the core: prefix or any
external identifier; the more fields the call carries, the better
the recommendation.
Models
bibliofabric.core.Work
A CORE work: the deduplicated record across its outputs.
Field names follow the camelCase wire names of the production responses; the snake_case spellings of the published OpenAPI document validate too.
bibliofabric.core.Output
One output: a version or source-specific instance of a work.
bibliofabric.core.Journal
A journal known to CORE.
bibliofabric.core.DataProvider
A data provider: the repository or journal CORE harvests from.
bibliofabric.core.DiscoveryResult
The best full text match for a deposit, as found by CORE.