re3data
The re3data client (bibliofabric.re3data) reads the
re3data API, version v40, which serves
the re3data Metadata Schema 4.0: a
filtered index of research data repositories and one full description per
repository. It returns typed Pydantic models and paces requests at two per
second on one connection. An async client and a generated sync twin expose
the same calls. The database entries of re3data.org are open data under
CC0 1.0; content on
the re3data site itself carries
CC BY 4.0.
Credentials
Every re3data route is public, so there are no credentials and no key
settings. The client defaults to two requests per second; tune it with
RE3DATA_MAX_REQUESTS_PER_SECOND and RE3DATA_MAX_CONCURRENCY, as the
settings guide describes.
Quick start
import asyncio
from bibliofabric.re3data import Re3dataClient, Re3dataFilters
async def main() -> None:
async with Re3dataClient() as client:
page = await client.repositories.search(
filters=Re3dataFilters(countries="NZL", types="institutional")
)
print(f"{len(page.results)} institutional repositories in New Zealand")
for summary in page.results[:5]:
print(" ", summary.id, "-", summary.name)
repository = await client.repository.get("r3d100010468")
print(repository.name, f"({repository.re3data_id})")
print("subjects:", [s.subject_name for s in repository.subjects])
asyncio.run(main())
6 institutional repositories in New Zealand
r3d100011662 - Manaaki Whenua - Landcare Research DataStore
r3d100012149 - DataHub
r3d100010345 - Statistics New Zealand
r3d100012110 - University of Auckland Data Repository
r3d100013525 - Data@Lincoln
Zenodo (r3d100010468)
subjects: ['Engineering Sciences', 'Humanities and Social Sciences', 'Life Sciences', 'Natural Sciences']
Sync quick start
from bibliofabric.re3data import Re3dataSyncClient
with Re3dataSyncClient() as client:
page = client.repositories.search(query="WDCC")
first = page.results[0]
repository = client.repository.get(first.id)
print(repository.name, repository.repository_url)
The sync client uses plain httpx.Client and never starts or touches an
event loop; see async and sync clients.
What the client offers
| Attribute | Returns | Methods |
|---|---|---|
client.repositories |
RepositorySummary records |
search, iterate, collect, first |
client.repository |
Repository records |
get, exists |
The list route serves every matching repository in one response and takes
no paging parameters, so search() returns the full result set and count
and batch_get raise ConfigurationError. The route answers HTTP 500
without a filter, so search() raises ConfigurationError before sending
when neither query, a Re3dataFilters model, nor raw params narrow the
request. The Re3dataFilters model carries the three most used array
filters (countries, subjects, types); the other thirty-odd filters of
the route (dataUploads[], pidSystems[], and so on) travel through the
raw params= mapping. select= raises ConfigurationError everywhere
because the API has no field selection.
Examples
Runnable scripts live in packages/bibliofabric/examples/re3data:
quickstart.py: a filtered search and one full description.sync_quickstart.py: the same calls with the sync client.
Next
- Upstream quirks: what the live API does differently from its documentation.
- API reference: every public class generated from the source.