BASE API reference
Generated from the source with mkdocstrings. Every name below is importable
from bibliofabric.base; nested value models stay importable from
bibliofabric.base.models.
Client
bibliofabric.base.BaseClient
Client for the BASE HTTP interface.
Access is credential-gated: the interface answers only requests from a
whitelisted IP or IP range, or requests carrying an apikey parameter.
api_key (settings key BASE_API_KEY) feeds that parameter and is
sent with, and redacted from the messages of, every request. The client
always reads the XML answer format, so it sends no format parameter;
answers arrive as Solr XML and are parsed into typed models.
documents: DocumentsResource
cached
property
The PerformSearch resource: document queries and lookups.
repositories: RepositoriesResource
cached
property
The ListRepositories and ListProfile directory client.
Settings
bibliofabric.base.BaseSettings
BASE-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 the
documented pace (1 request per second, one request in flight). The API
is credential-gated: access needs an IP whitelist entry or an apikey
parameter. api_key feeds that parameter; without it the client sends
no apikey.
Resources
bibliofabric.base.DocumentsResource
Search and retrieve BASE documents.
The interface has one search route, so get() resolves a dcdocid
through a one-record search, exists() reuses get(), and
batch_get is disabled: the interface has no route that returns many
records by id in one call.
get(id: str | int, *, select: Sequence[str] | None = None, params: Mapping[str, Any] | None = None) -> Document
async
Fetch one document by its dcdocid.
The lookup runs as query=dcdocid:<id> with hits=1; an empty
result raises :class:NotFoundError.
exists(id: str | int, *, params: Mapping[str, Any] | None = None) -> bool
async
Return True when a document with this dcdocid exists.
The probe reuses :meth:get because the interface answers every
HEAD with an error: the script has no per-id route.
bibliofabric.base.RepositoriesResource
The repository routes of the interface.
list() reads func=ListRepositories, which answers one unpaged
XML list; an optional coll scopes it to a pre-defined collection
(for example ceu for Europe or denw for North Rhine-Westphalia).
profile() reads func=ListProfile for one repository, named by
the internal_name a list entry carries.
list(*, coll: str | None = None, params: Mapping[str, Any] | None = None) -> list[Repository]
async
Return the repositories of BASE, or of one collection.
profile(target: str, *, params: Mapping[str, Any] | None = None) -> RepositoryProfile
async
Return the profile of one repository, named by internal name.
Sync twins
BaseSyncClient, DocumentsSyncResource, and RepositoriesSyncResource
are the generated sync twins of the classes above, with the same methods
without async and await. See
Async and sync clients.
Models
bibliofabric.base.Document
One BASE document record (a <doc> element of a search answer).
Field names follow the Dublin Core fields of the BASE index without the
dc prefix; the wire name is the pydantic alias. All fields are
optional because the answer carries only the fields of the record, and
fields= can narrow the answer further. dcoa keeps its wire
values: 0 is closed access, 1 is open access, 2 is unknown.
bibliofabric.base.Repository
One content provider as listed by ListRepositories.
internal_name is the target value that scopes searches to this
repository and that :meth:RepositoriesResource.profile takes.
bibliofabric.base.RepositoryProfile
The record counts of one repository as answered by ListProfile.