Skip to content

API reference

Generated from the source with mkdocstrings.

Client

bibliofabric.inspirehep.InspireHepClient

Client for the INSPIRE-HEP API.

The API needs no credentials and answers JSON. mailto sets the contact address in the User-Agent; an explicit argument wins over the settings value.

literature: LiteratureResource cached property

The literature collection.

authors: AuthorsResource cached property

The authors collection.

institutions: InstitutionsResource cached property

The institutions collection.

journals: JournalsResource cached property

The journals collection.

jobs: JobsResource cached property

The jobs collection.

seminars: SeminarsResource cached property

The seminars collection.

conferences: ConferencesResource cached property

The conferences collection.

experiments: ExperimentsResource cached property

The experiments collection.

data: DataResource cached property

The data collection.

The sync twin InspireHepSyncClient mirrors the client method for method and exports from the same module: from bibliofabric.inspirehep import InspireHepSyncClient.

Settings

bibliofabric.inspirehep.InspireHepSettings

INSPIRE-specific client settings.

Inherits timeout, max_retries, max_retry_wait, max_requests_per_second, max_concurrency, rate_limits, user_agent and mailto from :class:bibliofabric.config.BaseApiSettings and sets INSPIRE defaults: 2 requests per second and concurrency 2, inside the documented limit of 15 requests per 5 seconds per IP. The API needs no credentials, and mailto only sets the contact address in the User-Agent.

Resources

Each resource inherits the generic operations from bibliofabric.Resource (get, search, iterate, collect, first, count, exists, batch_get). Only the members the client changes or adds are shown here.

bibliofabric.inspirehep.LiteratureResource

Client for the /literature collection.

Beyond the inherited get, search, iterate, collect, first, count, exists, and batch_get, this resource reads the DOI and arXiv identifier routes, the alternative citation formats of a record, and the citations route.

by_doi(doi: str) -> LiteratureRecord async

Fetch the literature record of a DOI through GET /doi/{doi}.

A DOI without a literature record raises :class:NotFoundError.

by_arxiv(arxiv_id: str) -> LiteratureRecord async

Fetch the literature record of an arXiv identifier through GET /arxiv/{arxiv_id}.

formatted(id: str | int, *, output_format: str = 'bibtex', params: Mapping[str, Any] | None = None) -> str async

Return one literature record in another citation format as text.

output_format is one of bibtex, latex-eu, latex-us, cv, json, and json-expanded. INSPIRE renders the formats only for literature records; the cv format answers HTML.

citations(id: str | int, *, page: int | None = None, page_size: int | None = None, params: Mapping[str, Any] | None = None) -> Page[CitationSummary] async

Return one page of the records that cite id.

The citations route wraps its records in metadata instead of the hits envelope, and reports the citing total as citation_count.

iterate_citations(id: str | int, *, limit: int | None = None) -> AsyncIterator[CitationSummary]

Yield the records that cite id, page by page.

Stops at limit summaries, when the upstream total runs out, or when a page answers no records.

bibliofabric.inspirehep.AuthorsResource

Client for the /authors collection.

by_orcid(orcid: str) -> AuthorRecord async

Fetch the author record of an ORCID iD through GET /orcid/{orcid}.

An ORCID iD without an author record raises :class:NotFoundError.

The plain collections InstitutionsResource, JournalsResource, JobsResource, SeminarsResource, ConferencesResource, ExperimentsResource, and DataResource inherit every operation unchanged.

Record models

The models live in bibliofabric.inspirehep (LiteratureRecord, AuthorRecord, InstitutionRecord, JournalRecord, JobRecord, SeminarRecord, ConferenceRecord, ExperimentRecord, DataRecord, CitationSummary). Every field is optional, undeclared upstream fields stay reachable through the pydantic extra data, and the models are documented in the module docstrings.