API reference
Generated from the source with mkdocstrings. Every path below is the public
import path; private plumbing stays out of the pages. The sync twins mirror
every async resource under the suffixed name (TitresSyncResource,
MirabelSyncClient, and so on); their pages are identical, so they are not
listed again here.
Client
bibliofabric.mirabel.MirabelClient
Client for the Mir@bel API, version 1.
Every route reads without credentials. A partner key (settings field
partner_key, environment MIRABEL_PARTNER_KEY) unlocks the
/mes/ routes on client.mes and the partner-scoped fields of the
access routes. The client sends Accept: application/json on every
request and paces itself at half of the requested two requests per
second by default.
titres: TitresResource
cached
property
The titles resource: search and detail.
revues: RevuesResource
cached
property
The journals resource: publication history by id.
editeurs: EditeursResource
cached
property
The publishers resource: detail by id or IdRef.
acces: AccesResource
cached
property
The online-access resource: access lists by journal or title.
themes: ThemesResource
cached
property
The subject-taxonomy resource.
mes: MesResource
cached
property
The partner-scoped routes; they need a partner key.
Settings
bibliofabric.mirabel.MirabelSettings
Mir@bel-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
Mir@bel defaults (1 request per second, concurrency 2).
partner_key is the private partner key (partenaire query
parameter) that a Mir@bel partner activates on their administration
page. It unlocks the /mes/ routes and the partner-scoped fields
(url_proxy, identifiantpartenaire) of the public access routes.
max_requests_per_second: float | None = Field(default=DEFAULT_MAX_REQUESTS_PER_SECOND, gt=0)
class-attribute
instance-attribute
max_concurrency: int = Field(default=DEFAULT_MAX_CONCURRENCY, gt=0)
class-attribute
instance-attribute
partner_key: SecretStr | None = Field(default=None, repr=False)
class-attribute
instance-attribute
Resources
bibliofabric.mirabel.TitresResource
Client for /titres and /titres/{id}.
search() pages in windows of 1000 records through the offset
parameter; iterate() and collect() walk the windows until the
API answers a short page. The API reports no matched total, so
count() is not available. batch_get(ids, field="id") sends the
ids as one id=1,2,3 filter of at most 200 values.
bibliofabric.mirabel.RevuesResource
Client for /revues/{id}.
A revue is the publication history of one journal; the record embeds its titles. There is no revue listing or search route.
bibliofabric.mirabel.EditeursResource
Client for /editeurs/{id} and /editeurs/idref/{idref}.
get(id) looks a publisher up by its Mir@bel id, by_idref(idref)
by its IdRef PPN. There is no publisher listing or search route.
by_idref(idref: str) -> EditeurDetail
async
Fetch one publisher by its IdRef PPN (8 digits plus a check digit).
An unknown IdRef raises NotFoundError.
bibliofabric.mirabel.AccesResource
Client for /acces/revue and /acces/titres.
Both routes answer the complete, unpaged list of online-access records
that match the filters. Each requires at least one criterion, so
by_revue() and by_titre() raise ConfigurationError on an
empty filter model. When the settings carry a partner key, it travels
with every call and Mir@bel adds the partner-scoped fields
(urlproxy, identifiantpartenaire).
by_revue(filters: AccesRevueFilters | Mapping[str, Any] | None = None, *, on_error: Literal['raise', 'skip'] = 'raise', failures: list[ValidationError] | None = None, partner_key: str | None = None) -> list[Acces]
async
List the online accesses of one or several journals.
filters accepts an :class:AccesRevueFilters model or a plain
mapping; at least one criterion must be set. With on_error="skip",
records that fail validation are recorded in failures instead of
aborting.
by_titre(filters: AccesTitreFilters | Mapping[str, Any] | None = None, *, on_error: Literal['raise', 'skip'] = 'raise', failures: list[ValidationError] | None = None, partner_key: str | None = None) -> list[Acces]
async
List the online accesses of one or several titles.
filters accepts an :class:AccesTitreFilters model or a plain
mapping; at least one criterion must be set.
bibliofabric.mirabel.ThemesResource
Client for /themes, /themes/revue/{id}, /themes/titre/{id},
and /themes/grappe/{id}.
search() answers the complete ordered taxonomy (one call, no
paging); iterate() and collect() run over it unchanged. The
by_* methods answer the themes anchored on one journal, title, or
grappe.
by_grappe(grappe_id: int | str, *, partner_key: str | None = None) -> list[ThemeParRevue]
async
Return the themes of every journal in one grappe.
Private grappes need the partner key; pass partner_key= or set
MIRABEL_PARTNER_KEY.
by_revue(revue_id: int | str) -> list[Theme]
async
Return the themes attributed to one journal.
by_titre(titre_id: int | str) -> list[Theme]
async
Return the themes of the journal behind one title.
bibliofabric.mirabel.MesResource
Client for /mes/acces, /mes/acces/changes, and /mes/titres.
Every method needs a partner key: pass partner_key= or set
MIRABEL_PARTNER_KEY in the environment or settings.
acces(*, possession: bool | None = None, abonnement: bool | None = None, partner_key: str | None = None) -> list[Acces]
async
List the accesses on the partner's journals.
possession restricts to owned titles, abonnement to
subscribed ones; the two are mutually exclusive upstream, so pass at
most one.
acces_changes(depuis: int | str, *, possession: bool | None = None, abonnement: bool | None = None, partner_key: str | None = None) -> AccesChanges
async
List the access changes since a timestamp or a textual date.
depuis takes epoch seconds (1700000000) or a textual date as
the API writes it ("2019-01-20 12:30:00").
titres(*, ressourceid: int | None = None, possession: bool | None = None, abonnement: bool | None = None, partner_key: str | None = None) -> list[Titre]
async
List the partner's titles by possession or subscription.
ressourceid restricts the list to one resource (platform), for
example 3 for Cairn.info.
Models
bibliofabric.mirabel.Titre
A Mir@bel title record.
prefixe holds the leading article that Mir@bel strips from titre
("Le Monde" is prefixe="Le ", titre="Monde"). editeurs lists
the names of the current publishers; relations_editeurs carries the
typed publisher relations and is only present on detail answers.
full_title: str
property
The title with its prefix, as Mir@bel displays it.
issn_values: list[str]
property
The ISSN-P and ISSN-E values carried by this title.
bibliofabric.mirabel.Revue
The answer of /revues/{id}.
A "revue" is the publication history of one journal; titres lists
its titles, most recent first, and each carries the full title record.
latest_titre: Titre | None
property
The most recent title of the journal, or None.
bibliofabric.mirabel.Editeur
A Mir@bel publisher.
nom carries the name without its leading article, which lives in
prefixe. identifiants holds [key, value] pairs such as
["idref", "029524989"] or ["ror", "02fe4k4n2"].
full_name: str
property
The publisher name with its prefix, as Mir@bel displays it.
bibliofabric.mirabel.EditeurDetail
The answer of /editeurs/{id} and /editeurs/idref/{idref}.
relations_titres lists the publisher's titles with their roles.
bibliofabric.mirabel.Acces
One online-access declaration.
datedebut and datefin hold years or partial dates (2002,
2015-01, 2015-01-31). diffusion is one of libre,
restreint, abonné. nodebut and nofin are the first and
last known issue numbers, None when unknown. url_proxy and
identifiantpartenaire only appear when the query carried a partner
key.
bibliofabric.mirabel.Theme
One node of the Mir@bel taxonomy.
parentid is 0 for the root of the tree and the parent theme id
otherwise. /themes answers the whole ordered tree.
Filter models
bibliofabric.mirabel.TitreFilters
Filters of GET /titres. Mir@bel combines them with a logical AND.
actif: bool | None = None
class-attribute
instance-attribute
Only active titles, excluding replaced ones.
grappeid: int | None = None
class-attribute
instance-attribute
Numeric id of a grappe (title bundle); private grappes need a key.
id: IdFilter = None
class-attribute
instance-attribute
Mir@bel title id, or a comma-joined list of at most 200.
issn: StrFilter = None
class-attribute
instance-attribute
ISSN (or ISSN-e, ISSN-l) of the form XXXX-XXXX; the hyphen and
the check digit are optional. One value or a comma-joined list.
revueid: IdFilter = None
class-attribute
instance-attribute
Mir@bel journal id, or a comma-joined list of at most 200.
sudoc: StrFilter = None
class-attribute
instance-attribute
SUDOC PPN identifier.
themeid: int | None = None
class-attribute
instance-attribute
Numeric id of a theme from the /themes tree.
titre: str | None = None
class-attribute
instance-attribute
Title text; see the module docstring for the matching rules.
worldcat: IdFilter = None
class-attribute
instance-attribute
Worldcat OCN, or a comma-joined list of at most 200.
bibliofabric.mirabel.AccesRevueFilters
Filters of GET /acces/revue. At least one criterion is required.
issn: StrFilter = None
class-attribute
instance-attribute
ISSN of the form XXXX-XXXX; one value or a comma-joined list.
revueid: IdFilter = None
class-attribute
instance-attribute
Mir@bel journal id, or a comma-joined list of at most 200.
sudoc: StrFilter = None
class-attribute
instance-attribute
SUDOC PPN identifier.
worldcat: IdFilter = None
class-attribute
instance-attribute
Worldcat id, or a comma-joined list.
bibliofabric.mirabel.AccesTitreFilters
Filters of GET /acces/titres. At least one criterion is required.
abonnement: bool | None = None
class-attribute
instance-attribute
Restrict to the titles the partner subscribes to; needs a key.
actif: bool | None = None
class-attribute
instance-attribute
Only active titles, excluding replaced ones.
id: IdFilter = None
class-attribute
instance-attribute
Mir@bel title id, or a comma-joined list of at most 200.
issn: StrFilter = None
class-attribute
instance-attribute
ISSN (or ISSN-e, ISSN-l); one value or a comma-joined list.
possession: bool | None = None
class-attribute
instance-attribute
Restrict to the titles the partner owns; needs a partner key.
revueid: IdFilter = None
class-attribute
instance-attribute
Mir@bel journal id, or a comma-joined list of at most 200.
sudoc: StrFilter = None
class-attribute
instance-attribute
SUDOC PPN identifier.
titre: str | None = None
class-attribute
instance-attribute
Title text; see the module docstring for the matching rules.
worldcat: IdFilter = None
class-attribute
instance-attribute
Worldcat OCN, or a comma-joined list of at most 200.