Skip to content

Reference

Classes, methods, and models of bibliofabric.issn. All names are importable from the package top level.

IssnClient

The async client. IssnSyncClient exposes the same API synchronously.

Member Kind Purpose
records property RecordsClient for /resource/ISSN/{issn}
issn_l property IssnLClient for /resource/ISSN-L/{issn}
search property SearchClient for the HTML search
ltwa property LtwaClient for the LTWA table
default_headers property {"Accept": "application/ld+json"}

Constructor arguments: settings (defaults to get_settings()), base_url override for tests, and an optional caller-owned http_client.

RecordsClient and IssnLClient

Both share the same shape; the model differs.

Method Returns Notes
get(id) IssnRecord or IssnLRecord Typed model; record.raw holds the node
raw(id) dict The untouched JSON-LD node
exists(id) bool GET based; False on 404

The Portal has no list routes for these resources, so the inherited search, iterate, collect, first, count, and batch_get methods raise ConfigurationError naming the client and method before any HTTP call.

IssnLClient.download_table(dest) streams the public ISSN-L table zip to dest and returns the path. It writes a temporary file next to dest and moves it into place at the end, so an interrupted download leaves no partial file, and it follows a client base_url override.

IssnLClient.get, raw and exists accept the ISSN-L value or any ISSN of the cluster; a member ISSN resolves through the record route (one extra request) because the Portal serves the route only under the ISSN-L value.

Identifiers normalize through require_issn; invalid values raise ConfigurationError without a request, unregistered values raise NotFoundError. A node the models cannot read raises ValidationError with the request and response attached.

SearchClient

Method Returns Notes
page(query, ...) SearchPage One page of parsed rows; see the search page for parameters
iterate(query, ...) async iterator of SearchHit Walks pages; stops at limit, an empty page, or the total
count(query, ...) int or None The data-hits total

LtwaClient

Method Returns Notes
page(...) LtwaPage One table page; at most 100 rows
iterate(...) async iterator of LtwaEntry Walks pages; stops on the first empty page

Models

  • IssnRecord: one ISSN record node. Properties title (flattened main title, falling back to the key title), issn, issn_l, key_title; fields for titles (title_variants holds the raw variants), identifiers, cluster membership, provenance, url, and the cancelled and incorrect ISSN lists. Extra keys stay reachable, raw holds the node.
  • IssnLRecord: one ISSN-L node with hasPart entries (HasPart: format, id, identifier) and the issn_l property.
  • SearchPage: total, page, page_size, hits.
  • SearchHit: issn, issn_l, issn_h, title, detail_path, medium, medium_label, country, country_label, category, category_label, cancelled_issns, other_media.
  • OtherMedium: label, href.
  • LtwaPage: entries, page, page_size, search, languages, sort, order.
  • LtwaEntry: word, abbreviation, language.
  • IdentifiedBy, LangString, TitleValue, IsPartOf, RecordProvenance, GenerationActivity, RecordAttribution: the nested node models of a record.

Helpers

Name Purpose
is_valid_issn(value) Modulo 11 check digit validation (ASCII digits only)
require_issn(value) Normalize to the hyphenated form or raise ConfigurationError
parse_issn_record(node, response=) Validate one record node, setting raw; errors carry the response
parse_issn_l(node, response=) Validate one ISSN-L node, setting raw; errors carry the response
record_issn(record) Normalized ISSN of a record, or raise ValidationError
parse_search_page(html, page=, page_size=, response=) Parse one search result page; a missing container raises APIError
parse_ltwa_page(html) Parse one LTWA table page
IssnSettings, get_settings() Settings with the ISSN_ prefix
iter_issn_to_issn_l(zip_path) Stream IssnLink(issn, issn_l, medium) rows from the ISSN-L table
iter_issn_l_clusters(zip_path) Stream (issn_l, issns) pairs from the ISSN-L table