Skip to main content

Client for Data Space Connector service

Project description

Python client

API version: 0.1.1

Requirements

Installation & Usage

  1. If you don't have Poetry installed run:
pip install poetry
  1. Install dependencies:
poetry config virtualenvs.in-project true
poetry install --no-root
  1. Running tests:
poetry run pytest

You can test the application for multiple versions of Python. To do this, you need to install the required Python versions on your operating system, specify these versions in the tox.ini file, and then run the tests:

poetry run tox

Add the tox.ini file to client/.openapi-generator-ignore so that it doesn't get overwritten during client generation.

  1. Building package:
poetry build
  1. Publishing
poetry config pypi-token.pypi <pypi token>
poetry publish

Client generator

To generate the client, execute the following script from the project root folder

poetry --directory server run python ./tools/client_generator/generate.py --file ./api/openapi.yaml

Command

generate.py [--file <a path or URL to a .yaml file>] [--asyncio]

Arguments

--file Specifies the input OpenAPI specification file path or URL. This argument is required for generating the Python client. The input file can be either a local file path or a URL pointing to the OpenAPI schema.

--asyncio Flag to indicate whether to generate asynchronous code. If this flag is provided, the generated Python client will include asynchronous features. By default, synchronous code is generated.

Saving Arguments

The script saves provided arguments for future use. Upon the initial execution, if no arguments are provided, the script will check if there are previously saved arguments in the specified file path. If saved arguments are found, they will be loaded and used for generating the client. If no saved arguments are found or if new arguments are provided, the script will save the provided arguments for future use.

This mechanism ensures that users can omit specifying arguments on subsequent executions if the same arguments were used previously. Saved arguments are stored in a JSON file located at generator/args.json.

Configuration

You can change the name of the client package in the file /tools/client_generator/config.json.

Add file's paths to client/.openapi-generator-ignore so that it doesn't get overwritten during client generation.

Examples

python generate.py --file https://<domain>/openapi.json
python generate.py --file https://<domain>/openapi.json --asyncio
python generate.py --file /<path>/openapi.yaml
python generate.py --file /<path>/openapi.yaml --asyncio
python generate.py

Getting Started

Please follow the installation procedure and then run the following:

import ds_connector
from ds_connector.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to http://localhost
# See configuration.py for a list of all supported configuration parameters.
configuration = ds_connector.Configuration(
    host = "http://localhost"
)



# Enter a context with an instance of the API client
with ds_connector.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = ds_connector.DataProductApi(api_client)
    connector_id = 'connector_id_example' # str | 
    data_product_id = 'data_product_id_example' # str | 

    try:
        # Get a data product details
        api_response = api_instance.get_data_product(connector_id, data_product_id)
        print("The response of DataProductApi->get_data_product:\n")
        pprint(api_response)
    except ApiException as e:
        print("Exception when calling DataProductApi->get_data_product: %s\n" % e)

Documentation for API Endpoints

All URIs are relative to http://localhost

Class Method HTTP request Description
DataProductApi get_data_product GET /data-products/{connector_id}/{data_product_id}/ Get a data product details
DataProductApi get_data_products GET /data-products/ Get a list of data products
DefaultApi health_check GET /health-check/ Health check
DefaultApi metrics_metrics_get GET /metrics Metrics

Documentation For Models

Documentation For Authorization

Endpoints do not require authorization.

Author

all-hiro@hiro-microdatacenters.nl

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

ds_connector-0.1.1.tar.gz (25.7 kB view details)

Uploaded Source

Built Distribution

ds_connector-0.1.1-py3-none-any.whl (44.0 kB view details)

Uploaded Python 3

File details

Details for the file ds_connector-0.1.1.tar.gz.

File metadata

  • Download URL: ds_connector-0.1.1.tar.gz
  • Upload date:
  • Size: 25.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.5 Linux/6.5.0-1025-azure

File hashes

Hashes for ds_connector-0.1.1.tar.gz
Algorithm Hash digest
SHA256 18c0383b6845525ae217fd0085fea59c917d995e7c2aab0c6a51b200cd0b4842
MD5 344fb981d9fc849df67fce2256070b4a
BLAKE2b-256 fd3ec3919e14734733dfa8585d87f4b548b456420ff592a9669791499961484d

See more details on using hashes here.

File details

Details for the file ds_connector-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: ds_connector-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 44.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.5 Linux/6.5.0-1025-azure

File hashes

Hashes for ds_connector-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a22c9429317fcc0084493fff5de6502fb344531e084354dcc577834c04d2bcae
MD5 c155eebcb4ebd6d788b6622a100be844
BLAKE2b-256 620fd327e1ef8707fdff220d4881038ebb911275fe24eaad2b554156c689828c

See more details on using hashes here.

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