FAIR Data Point API client
Project description
fairdatapoint-client
Contents
Overview
fairdatapoint-client is a simple and elegant library to interact with FAIR Data Point resources from Python, e.g. read and write catalogs, datasets and distributions in an FDP server.
The supported APIs are listed below:
FDP Layers | Path Endpoint | Specific Resource Endpoint |
---|---|---|
fdp | [baseURL] or [baseURL]/fdp | |
catalog | [baseURL]/catalog | [baseURL]/catalog/[catalogID] |
dataset | [baseURL]/dataset | [baseURL]/dataset/[datasetID] |
distribution | [baseURL]/distribution | [baseURL]/distribution/[distributionID] |
Installation
It requires a Python version of 3.7, 3.8 or 3.9.
Stable Release
The fairdatapoint-client is available on PyPI, you can install it using:
pip install fairdatapoint-client
Development Version
You can also install from the latest source code, but note that the in-development version might be unstable:
git clone https://github.com/fair-data/fairdatapoint-client.git
cd fairdatapoint-client
pip install .
To run tests (including coverage):
pip install '.[tests]'
pytest
Tutorial
Using Client
from fdpclient.client import Client
# create a client with base URL
client = Client('http://example.org')
# create metadata
with open('catalog01.ttl') as f:
data = f.read()
client.create_catalog(data)
# let's assume the catalogID was assigned as 'catalog01'
# read metadata, return a RDF graph
r = client.read_catalog('catalog01')
print(r.serialize(format="turtle").decode("utf-8"))
# update metadata
with open('catalog01_update.ttl') as f:
data_update = f.read()
client.update_catalog('catalog01', data_update)
# delete metadata
client.delete_catalog('catalog01')
Using operation functions
from fdpclient import operations
# create metadata
with open('catalog01.ttl') as f:
data = f.read()
operations.create('http://example.org/catalog', data)
# read metadata, return a RDF graph
r = operations.read('http://example.org/catalog/catalog01')
print(r.serialize(format="turtle").decode("utf-8"))
# update metadata
with open('catalog01_update.ttl') as f:
data_update = f.read()
operations.update('http://example.org/catalog/catalog01', data_update)
# delete metadata
operations.delete('http://example.org/catalog/catalog01')
Issues and Contributing
If you have questions or find a bug, please report the issue in the Github issue channel.
If you want to contribute to the development of fairdatapoint-client, have a look at the contribution guidelines.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file fairdatapoint-client-0.1.0.tar.gz
.
File metadata
- Download URL: fairdatapoint-client-0.1.0.tar.gz
- Upload date:
- Size: 12.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/52.0.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.7.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a3ae39b15f5ece4c90bb61fad047694696b9eaf0d3363a8697766b6ec5d975fe |
|
MD5 | d20192d7ef143f599b60f2848b2f2a66 |
|
BLAKE2b-256 | 3eadbca1a8e1fcd335482a24e91cf9f1bca6df7ec4a0b8ed75fede3ac0d1561f |
File details
Details for the file fairdatapoint_client-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: fairdatapoint_client-0.1.0-py3-none-any.whl
- Upload date:
- Size: 18.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/52.0.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.7.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 95ee46556bc5116e627bf4f6bdf58242e7dda65b0fb79fdfa72cd1fe12555dce |
|
MD5 | 4d21f47a4efa8159c66bbfd9874ead74 |
|
BLAKE2b-256 | 67d20407f28dba70ffd1c19741393f584bc051aa6bced02052c73b8c223ab009 |