Resource Catalog

Client for accessing the resource catalog

class slipo.catalog.CatalogClient(base_url: str, api_key: str)[source]

CatalogClient provides methods for querying the resource catalog and downloading RDF datasets. All datasets are encoded in N-Triples format.

Details about the API responses are available at the SLIPO site.

Parameters
  • base_url (str) – Base URL for SLIPO API endpoints. The default value is https://app.dev.slipo.eu/.

  • api_key (str) – SLIPO API key. An application key can be generated using the SLIPO Workbench application.

Returns

A CatalogClient object.

query(term: str = None, pageIndex: int = 0, pageSize: int = 10) → dict[source]

Query resource catalog for RDF datasets.

Parameters
  • term (str, optional) – A term for filtering resources. If specified, only the resources whose name contains the term are returned.

  • pageIndex (str, optional) – Page index for data pagination.

  • pageSize (str, optional) – Page size for data pagination.

Returns

A dict representing the parsed JSON response.

Raises

SlipoException – If a network or server error has occurred.

download(resource_id: int, resource_version: int, target: str) → None[source]

Download a resource to the local file system

Parameters
  • resource_id (int) – The resource id.

  • resource_version (int) – The resource revision.

  • target (str) – The path where to save the file.

Raises

SlipoException – If a network, server error or I/O error has occurred.