API Reference¶
BaseClient
¶
A base class for clients that interact with the re3data API.
Source code in src/re3data/_client/base.py
Client
¶
Bases: BaseClient
A client that interacts with the re3data API.
Attributes:
Name | Type | Description |
---|---|---|
_client | Client | The underlying HTTP client. |
_repository_manager | RepositoryManager | The repository manager to retrieve metadata from the repositories endpoints. |
Examples:
>>> client = Client():
>>> response = client.repositories.list()
>>> response
[RepositorySummary(id='r3d100010468', doi='https://doi.org/10.17616/R3QP53', name='Zenodo', link=Link(href='https://www.re3data.org/api/beta/repository/r3d100010468', rel='self'))]
... (remaining repositories truncated)
>>> response = client.repositories.list(query="biosharing")
>>> response
[RepositorySummary(id='r3d100010142', doi='https://doi.org/10.17616/R3WS3X', name='FAIRsharing', link=Link(href='https://www.re3data.org/api/beta/repository/r3d100010142', rel='self'))]
Source code in src/re3data/_client/_sync.py
repositories: RepositoryManager
property
¶
Get the repository manager for this client.
Returns:
Type | Description |
---|---|
RepositoryManager | The repository manager. |
RepositoryManager
¶
A manager for interacting with repositories in the re3data API.
Attributes:
Name | Type | Description |
---|---|---|
_client | The client used to make requests. |
Source code in src/re3data/_client/_sync.py
get(repository_id, return_type=ReturnType.DATACLASS)
¶
Get the metadata of a specific repository.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
repository_id | str | The identifier of the repository to retrieve. | required |
return_type | ReturnType | The desired return type for the API resource. Defaults to | DATACLASS |
Returns:
Type | Description |
---|---|
Repository | Response | dict[str, Any] | str | Depending on the |
Raises:
Type | Description |
---|---|
ValueError | If an invalid |
HTTPStatusError | If the server returned an error status code >= 500. |
RepositoryNotFoundError | If no repository with the given ID is found. |
Source code in src/re3data/_client/_sync.py
list(query=None, return_type=ReturnType.DATACLASS, count=False)
¶
List the metadata of all repositories in the re3data API.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
query | str | None | A query string to filter the results. If provided, only repositories matching the query will be returned. | None |
return_type | ReturnType | The desired return type for the API resource. Defaults to | DATACLASS |
count | bool | Whether to return the total number of matching items instead of a list of repositories. | False |
Returns:
Type | Description |
---|---|
list[RepositorySummary] | Response | dict[str, Any] | str | int | Depending on the |
Raises:
Type | Description |
---|---|
ValueError | If an invalid |
HTTPStatusError | If the server returned an error status code >= 500. |
Source code in src/re3data/_client/_sync.py
AsyncClient
¶
Bases: BaseClient
A client that interacts with the re3data API.
Attributes:
Name | Type | Description |
---|---|---|
_client | AsyncClient | The underlying HTTP client. |
_repository_manager | AsyncRepositoryManager | The repository manager to retrieve metadata from the repositories endpoints. |
Examples:
>>> async_client = AsyncClient():
>>> response = await async_client.repositories.list()
>>> response
[RepositorySummary(id='r3d100010468', doi='https://doi.org/10.17616/R3QP53', name='Zenodo', link=Link(href='https://www.re3data.org/api/beta/repository/r3d100010468', rel='self'))]
... (remaining repositories truncated)
>>> response = await async_client.repositories.list(query="biosharing")
>>> response
[RepositorySummary(id='r3d100010142', doi='https://doi.org/10.17616/R3WS3X', name='FAIRsharing', link=Link(href='https://www.re3data.org/api/beta/repository/r3d100010142', rel='self'))]
Source code in src/re3data/_client/_async.py
repositories: AsyncRepositoryManager
property
¶
Get the repository manager for this client.
Returns:
Type | Description |
---|---|
AsyncRepositoryManager | The repository manager. |
AsyncRepositoryManager
¶
A manager for interacting with repositories in the re3data API.
Attributes:
Name | Type | Description |
---|---|---|
_client | The client used to make requests. |
Source code in src/re3data/_client/_async.py
get(repository_id, return_type=ReturnType.DATACLASS)
async
¶
Get the metadata of a specific repository.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
repository_id | str | The identifier of the repository to retrieve. | required |
return_type | ReturnType | The desired return type for the API resource. Defaults to | DATACLASS |
Returns:
Type | Description |
---|---|
Repository | Response | dict[str, Any] | str | Depending on the |
Raises:
Type | Description |
---|---|
ValueError | If an invalid |
HTTPStatusError | If the server returned an error status code >= 500. |
RepositoryNotFoundError | If no repository with the given ID is found. |
Source code in src/re3data/_client/_async.py
list(query=None, return_type=ReturnType.DATACLASS, count=False)
async
¶
List the metadata of all repositories in the re3data API.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
query | str | None | A query string to filter the results. If provided, only repositories matching the query will be returned. | None |
return_type | ReturnType | The desired return type for the API resource. Defaults to | DATACLASS |
count | bool | Whether to return the total number of matching items instead of a list of repositories. | False |
Returns:
Type | Description |
---|---|
list[RepositorySummary] | Response | dict[str, Any] | str | int | Depending on the |
Raises:
Type | Description |
---|---|
ValueError | If an invalid |
HTTPStatusError | If the server returned an error status code >= 500. |
Source code in src/re3data/_client/_async.py
Response
¶
A response received from the re3data API, encapsulating the HTTP response.
Attributes:
Name | Type | Description |
---|---|---|
url | URL | The URL of the request. |
status_code | codes | The HTTP status code of the response. |
headers | Headers | A dictionary-like object containing metadata about the response, such as content type and length. |
text | str | The text content of the response. |