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 (ItemsSyncResource,
CategoriesSyncResource, SubjectsSyncResource, LicensesSyncResource,
OaiPmhSyncResource); their pages are identical, so they are not listed
again here.
Client
bibliofabric.chemrxiv.ChemRxivClient
Client for the ChemRxiv public API (chemrxiv.org).
The API needs no credentials. The client paces itself at one request
per second over one connection. It wraps the JSON routes of the
published ChemRxiv API and mounts the OAI-PMH 2.0 harvester of the same
host as client.oai.
items: ItemsResource
cached
property
Preprint records: search, by id, and by DOI.
categories: CategoriesResource
cached
property
The subject categories of the archive.
subjects: SubjectsResource
cached
property
The top-level subjects of the archive.
licenses: LicensesResource
cached
property
The licenses items are posted under.
oai: OaiPmhResource
cached
property
The OAI-PMH 2.0 harvester of the same host.
The endpoint serves Dublin Core (oai_dc) over the public
metadata; see the bibliofabric OAI-PMH guide for the harvest
calls. OAI errors answer HTTP 400 with a JSON body, so the
harvester runs with error_status=None and a rejected verb or
metadata prefix raises APIError.
api_version() -> str
async
Return the API version string the /version route reports.
Settings
bibliofabric.chemrxiv.ChemRxivSettings
ChemRxiv-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. The API
needs no credentials; write routes do not exist on the public surface.
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.chemrxiv.ItemsResource
Client for the /items routes.
search() and its derived methods page by skip/limit offset.
get() reads /items/{id} by item id, by_doi() reads
/items/doi/{doi}. Every version of an item is a full item record;
versionRefs on a record names the item id of each version.
by_doi(doi: str) -> Item
async
Return one item by its DOI; a miss raises NotFoundError.
doi accepts the bare DOI (10.26434/chemrxiv-2024-25hj6) and a
doi.org URL. The version suffix is part of a ChemRxiv DOI when it
was registered with one (10.26434/chemrxiv.8011268.v1), so it is
kept verbatim.
get(id: str | int, *, select: Sequence[str] | None = None, params: Mapping[str, Any] | None = None) -> Item
async
Return one item by its id; a miss raises NotFoundError.
Withdrawn items answer HTTP 410, which raises NotFoundError too.
bibliofabric.chemrxiv.CategoriesResource
Client for the /categories route.
The route answers one unpaged list of every category with its id, name,
description, preprint count, and parent category id. search()
returns the list as one page; iterate() and collect() yield the
categories.
bibliofabric.chemrxiv.SubjectsResource
Client for the /subjects route.
The route answers one unpaged list of every top-level subject with its
id, name, description, and preprint count. Subject ids filter
items.search() through ItemFilters.subject_ids. The route is not
in the last published ChemRxiv specification, but the same platform
route serves on the live Cambridge Open Engage instances and item
records carry their subject; see docs/chemrxiv/upstream-quirks.md.
bibliofabric.chemrxiv.LicensesResource
Client for the /licenses route.
The route answers one unpaged list of every license with its id, name,
description, and URL. License ids filter items.search() through
ItemFilters.search_license.
Models
bibliofabric.chemrxiv.Item
One ChemRxiv preprint, or one version of one.
The search hits, the /items/{itemId} route, and the DOI route all
answer this schema. versionRefs carries the version history: one
entry per posted version, each naming the itemId under which that
version answers on the /items/{itemId} route. isLatestVersion
says whether this record is the newest one.
bibliofabric.chemrxiv.Author
One author of an item or of a comment.
bibliofabric.chemrxiv.Category
One subject category from the /categories route or an item record.
The route answers count (published preprints in the category) and
parentId; the categories inside an item record carry only id,
name, and description.
bibliofabric.chemrxiv.Subject
One top-level subject from the /subjects route or an item record.
Items carry their subject as an object; the route answers the same shape
plus a count of published preprints.
bibliofabric.chemrxiv.License
One license from the /licenses route.
Filters and helpers
bibliofabric.chemrxiv.ItemFilters
Filters of the /items search route.
Dates accept date and datetime objects and strings in
YYYY-MM-DD or YYYY-MM-DDTHH:MM:SSZ form. Ids are the 24-character
hexadecimal ids of the /categories, /subjects, and /licenses
routes.
bibliofabric.chemrxiv.sort_token(sort: str) -> str
Return the wire token of a sort value.
Accepts the wire token itself (PUBLISHED_DATE_DESC) and the
field:direction spelling in any capitalization
(published_date:desc). Anything else raises
:class:ConfigurationError.