Skip to main content

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)

Uploaded Source

Built Distribution

fdpAPIconnector-0.0.2-py3-none-any.whl (7.8 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page