bibliofabric.arxiv
The Arxiv client (bibliofabric.arxiv) is a Python client for the arXiv API. It searches arXiv and looks up papers by id through the query route, parses the Atom feeds into Pydantic models, and paces requests at one every three seconds over one connection, as the arXiv terms of use ask. It ships an async client and a generated sync twin with the same API.
Install
uv add bibliofabric
Requires Python 3.12 or newer.
The Arxiv client ships in bibliofabric 0.9.0 and newer.
Quick start
from bibliofabric.arxiv import ArxivClient
async with ArxivClient() as client:
paper = await client.query.get("1706.03762")
paper.title, paper.version, paper.primary_category, paper.pdf_url
page = await client.query.search("ti:transformer AND cat:cs.CL", page_size=5)
page.total, [record.arxiv_id for record in page.results]
The sync twin ArxivSyncClient has the same methods without await.
Examples
Runnable scripts live at
packages/bibliofabric/examples/arxiv:
quickstart.py (get, search, bounded iterate), arxiv_sync.py (the sync
client and batch lookups by id), and query_builder.py (clause, date
range, and combine helpers).
Where to go next
- Query covers search syntax, paging, and lookups by id.
- Upstream quirks lists what the live API does differently from its documentation.
- The API reference is generated from the source.