Bibliofabric
A generic, extensible Python framework for building asynchronous and synchronous API clients for scholarly and bibliometric data sources.
Built on httpx and pydantic, bibliofabric handles the boilerplate every API
client needs: retries, throttling, authentication, streaming, paging, batch
retrieval, error mapping, and typed resource clients. A client library only
adds what is specific to its API.
Who is this for?
bibliofabric is a framework for developers building API client libraries. It is not an end-user library. You would use it to build a library like AIREloom (OpenAIRE), which researchers then use directly.
Core concepts
| Component | Role |
|---|---|
BaseApiClient / SyncBaseApiClient |
Generic async/sync HTTP client: idempotent retries, throttling, auth, on_response(), stream(), error mapping |
QueryDialect |
Declares an API's paging, offset limits, sort, search, and select parameters |
ResourceClient[E] / SyncResourceClient[E] |
Typed client for one endpoint: get, exists, search, iterate, count, batch_get |
Page[E] |
Uniform search result envelope |
ResponseUnwrapper |
Protocol for parsing API-specific JSON envelopes |
AuthStrategy |
Pluggable auth: bearer, HTTP Basic, query parameter, header, OAuth2 client-credentials & refresh-token |
BaseApiSettings |
pydantic-settings configuration with env var support |
Start with the quick start in the README, then read:
- Client — HTTP lifecycle, retries, streaming, throttling
- Sync usage — generated sync twins (
SyncBaseApiClient,SyncResourceClient) - Resources —
ResourceClientand its hooks - Paging — dialects and
Page - Unwrapping — the response envelope protocol
- Errors, retries, limits
- Configuration, Authentication, Identifiers, Types, Exceptions
- Writing a client with sync support