Stavrophora
Stavrophora is a Python client for the Crossref REST API, with an async variant and a generated sync twin. It is built on bibliofabric and covers the works, journals, funders, members, types, prefixes, and licenses routes with typed Pydantic models, plus the beta Data Citations API.
Install
Requires Python 3.12 or newer.
uv add stavrophora
Quick start
import asyncio
from stavrophora import StavrophoraClient
async def main() -> None:
async with StavrophoraClient(mailto="you@example.org") as client:
work = await client.works.get("10.1038/nature12373")
print(work.primary_title)
page = await client.works.search(
query="proteomics", select=["DOI", "title"], page_size=5
)
for work in page.results:
print(work.doi, work.primary_title)
asyncio.run(main())
search() returns a Page with .results (typed models), .total, .next_cursor, and .meta (the response envelope minus the results).
Sync usage
Every class has a generated sync twin: StavrophoraClient pairs with StavrophoraSyncClient, and each resource class pairs with a Sync-prefixed twin (WorksResource -> SyncWorksResource). Both variants take the same parameters, raise the same errors, retry and page the same way, and enforce the same per-class rate limits.
from stavrophora import StavrophoraSyncClient
with StavrophoraSyncClient(mailto="you@example.org") as client:
work = client.works.get("10.1038/nature12373")
page = client.works.search(query="proteomics", select=["DOI", "title"], page_size=5)
for work in page.results:
print(work.doi, work.primary_title)
The sync client uses httpx.Client, time.sleep, and threads, and never starts or touches an event loop, so it works in plain scripts, in Jupyter, and when called from inside a running event loop. See Sync usage for when to pick which variant.
Credentials
The Crossref API needs no authentication. Two optional credentials change how requests are sent:
| Credential | How to set it | What it does |
|---|---|---|
| Polite pool email | mailto= or STAVROPHORA_MAILTO |
Sent as a mailto query parameter; raises your rate limits |
| Metadata Plus key | plus_token= or STAVROPHORA_PLUS_TOKEN |
Sent as a crossref-api-key: Bearer <key> header |
A plus_token replaces mailto as the credential when both are set. An explicit auth_strategy= argument overrides both.
When rate limits are not explicitly configured, StavrophoraClient applies pool-aware defaults (Public: 5/1 req/s, Polite: 10/3 req/s, Metadata Plus: 50/50 req/s) and tracks Crossref's x-api-pool / x-rate-limit-* response headers via client.last_pool and client.last_rate_limit_headers.
Where to go next
- Works: search, filters, cursor iteration, batch DOI lookup, facets, sample, agency, and scoped works routes.
- Errors, retries, rate limits.
- Crossref quirks: behavior the client defends against.
- API reference.