Python package to connect to a FDP API
Project description
fdpAPIconnector.py
Python package for communictaion with a FairDataPoint (FDP) API. This is based on the fairdatapoint-client api client but adapted for FAIRDataTeam/FAIRDataPoint.
Usage
Import the FDPClient within your Python or Jupyter script.
from fdpAPIconnector.fdpclient import FDPClient
Create an instance of the client and login
fdp_baseurl = "http://localhost:8088"
email = "abmin@FDP.org"
password = "SuperSecretePassword"
fdpclient=FDPClient(fdp_baseurl,email,password)
You can also use an api_token
fdpclient=FDPClient(fdp_baseurl,api_token = 'APITOKEN123456789')
You may change the templates used for catalogs, datasets and distributions
fdpclient=FDPClient(fdp_baseurl,email,password,
catalog_template='./<pathToTemplates>/catalog_template.ttl',
dataset_template='./<pathToTemplates>/dataset_template.ttl,
distribution_template='./<pathToTemplates>/distribution_template.ttl
)
Create a new Catalog
newcat=fdpclient.createCatalogRDF(DESCRIPTION='My First Catalog',
title='My First Catalog',
version="1.0.0",
ispartof=fdpclient.publicurl,
publisher='Projektmanagementteam',
LANGUAGE='http://id.loc.gov/vocabulary/iso639-1/en',
HOMEPAGE=fdpclient.baseurl)
pprint(newcat)
id=fdpclient.create(type='catalog',data=newcat)
print(id)
TODOs
- allow "login" via api-token instead of email and password
- auto check for strings and urls(or iri) for RDF turtle creation
- Create a nice documentation
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
fdpAPIconnector-0.0.2.tar.gz
(7.9 kB
view hashes)
Built Distribution
Close
Hashes for fdpAPIconnector-0.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f4aed7c204249695d30abb62595bfb9dc484dcee805a9ea4bece914bea614fa6 |
|
MD5 | dd8a367f490399204adaaa1744cd431f |
|
BLAKE2b-256 | 7353452fa56f99c18c9c1e3f355b3284761fbba747d2eec272411dfffd4e7b55 |