Skip to content

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 (HkdirSyncClient, JournalsSyncResource, and so on); their pages are identical, so they are not listed again here.

Client

bibliofabric.hkdir.HkdirClient

Client for the DBH kanalregister API on kanalregister.hkdir.no.

The publication-channel tables 850 to 853 are open data and need no credentials. The client paces requests at half of the catalog cap of two per second by default.

publishers: PublishersResource cached property

DBH table 850, the publishers (forlag).

journals: JournalsResource cached property

DBH table 851, the journals (tidsskrift).

publisher_levels: PublisherLevelsResource cached property

DBH table 852, the publisher level per year.

journal_levels: JournalLevelsResource cached property

DBH table 853, the journal level per year.

Settings

bibliofabric.hkdir.HkdirSettings

HK-dir kanalregister 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 defaults of 1 request per second and concurrency 2. The API needs no credentials; the GDPR-shielded DBH tables behind Feide tokens are out of scope.

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

Resources

bibliofabric.hkdir.PublishersResource

Client for DBH table 850, the publication-channel publishers.

bibliofabric.hkdir.JournalsResource

Client for DBH table 851, the publication-channel journals.

bibliofabric.hkdir.PublisherLevelsResource

Client for DBH table 852, the publisher level per year.

bibliofabric.hkdir.JournalLevelsResource

Client for DBH table 853, the journal level per year.

Models

bibliofabric.hkdir.Publisher

One publisher (forlag) of DBH table 850.

bibliofabric.hkdir.Journal

One journal (tidsskrift) of DBH table 851.

bibliofabric.hkdir.PublisherLevel

One publisher-year level row of DBH table 852.

bibliofabric.hkdir.JournalLevel

One journal-year level row of DBH table 853.

Query filters

bibliofabric.hkdir.DbhFilter

One filter clause of the DBH query language.

values and exclude travel as strings on the wire, so years and ids pass as "2024" or "478900". exclude may stay empty; the API treats "item" clauses without exclude.

Examples: DbhFilter(variabel="Tidsskrift id", filter="item", values=["478900"]) or DbhFilter(variabel="Sist endret", filter="between", values=["Jan 01 2026", "Jun 30 2026"]).

bibliofabric.hkdir.DbhFilterSet

Several filter clauses sent as one query filter list.

Bulk CSV reader

bibliofabric.hkdir.iter_table_csv(path: Path | str, model: type[M]) -> Iterator[M]

Yield one record per row of a downloaded bulk-csv snapshot.

The file is read row by row, so memory use stays flat. Rows shorter than the header get empty strings for their missing cells and cells past the header are dropped, mirroring what the API writes. An empty file yields nothing.