Skip to main content

SDK for interacting with the Flythings Dataspace Connector

Project description

About The Project

This is the Python SDK of the Flythings Connector Project.

Build

pip install flythings-dataspace-sdk

Content

  • Auth: This module includes all the authentication logic
  • Connector: This module includes all the clients and services that interface with Flythings Connector
  • Model: This module contains all the required EDC entities

Requirements

Tool Version
Python 3.9+

Dependencies

Runtime

Package Version Description
httpx >=0.27 HTTP client with async support

Development

Package Version Description
pytest >=8.0 Test framework

Authentication

Authentication is configured on the DataspaceClient, which is the central entry point for the SDK. It supports two authentication strategies: static token and credentials-based.

Note: Static tokens may expire during long-running operations. If your use case requires uninterrupted access, prefer credentials-based authentication, which handles token renewal automatically.

Static Token

from flythings_dataspace_sdk import DataspaceClient, TokenAuth

auth = TokenAuth(token="my-token")

client = DataspaceClient(
    base_url="https://sdk.api.url",
    auth=auth,
)

Credentials (Recommended)

from flythings_dataspace_sdk import DataspaceClient, BasicLoginAuth

auth = BasicLoginAuth(
    auth_base_url="https://sdk.auth.url",
    username="my-username",
    password="my-password",
)

client = DataspaceClient(
    base_url="https://sdk.api.url",
    auth=auth,
)

When using BasicLoginAuth, the client acquires and refreshes tokens automatically, ensuring requests remain authenticated without manual intervention.

An optional timeout (in seconds) can be passed to DataspaceClient:

from flythings_dataspace_sdk import DataspaceClient, TokenAuth

auth = TokenAuth(token="my-token")

client = DataspaceClient(base_url="my-base-url", auth=auth, timeout=10)

Environment Variables (Recommended for Production)

The SDK can be configured entirely via environment variables using the from_env() factory:

from flythings_dataspace_sdk import DataspaceClient

client = DataspaceClient.from_env()

The following variables are read automatically:

Variable Description
DATASPACE_BASE_URL The SDK API base URL
DATASPACE_AUTH_BASE_URL The authentication service URL
DATASPACE_USERNAME Username for credentials-based auth
DATASPACE_PASSWORD Password for credentials-based auth

Usage

The DataspaceClient exposes all clients and services as attributes — no separate instantiation is needed.

DownloadService

download_service downloads the contents of an asset identified by a contract agreement. The response is returned as bytes.

Minimal usage — only agreement_id is required:

from flythings_dataspace_sdk import DataspaceClient, DownloadRequest

client = DataspaceClient.from_env()

file = client.download_service.download(
    DownloadRequest(agreement_id="a3fe7fee-b359-477c-ab9d-0f9671601bf4")
)

Note: You can retrieve the agreement_id from the web interface. Navigate to Contracts, select a contract for your desired asset, click View Details, and locate the Agreement ID in the Agreement section. agreement

Full configuration — the following shows all available parameters with their defaults:

from flythings_dataspace_sdk import DataspaceClient, DownloadRequest

client = DataspaceClient.from_env()

file = client.download_service.download(
    DownloadRequest(
        agreement_id="a3fe7fee-b359-477c-ab9d-0f9671601bf4",
        transfer_type="HttpData-PUSH",
        data_address_type="HttpProxy",
        protocol="dataspace-protocol-http",
        context=["https://w3id.org/edc/connector/management/v0.0.1"],
    )
)
Parameter Default Description
transfer_type HttpData-PUSH The transfer mechanism used to move the data
data_address_type HttpProxy Specifies how the asset's data address is resolved
protocol dataspace-protocol-http The dataspace protocol used for the transfer negotiation
context EDC management v0.0.1 JSON-LD @context — override when using a custom or domain-specific ontology

The default configuration assumes an HTTP-based transfer. For non-HTTP assets (e.g., S3, Azure Blob), adjust transfer_type, data_address_type, and protocol accordingly.

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

flythings_dataspace_sdk-1.0.2.tar.gz (20.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

flythings_dataspace_sdk-1.0.2-py3-none-any.whl (29.6 kB view details)

Uploaded Python 3

File details

Details for the file flythings_dataspace_sdk-1.0.2.tar.gz.

File metadata

  • Download URL: flythings_dataspace_sdk-1.0.2.tar.gz
  • Upload date:
  • Size: 20.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for flythings_dataspace_sdk-1.0.2.tar.gz
Algorithm Hash digest
SHA256 969ac3ced7deed3d93490d905f09748581dc46c9c977a571d2ea6022894d6837
MD5 fe202f7eedc9fd025721113903c3b1a1
BLAKE2b-256 1ef404455223b5c456e76db3c0995dd41f9bf3a62a2d826c585a96996a469a4e

See more details on using hashes here.

File details

Details for the file flythings_dataspace_sdk-1.0.2-py3-none-any.whl.

File metadata

File hashes

Hashes for flythings_dataspace_sdk-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 0209e8755dada26e20e4551c963e471321cc90a1d7f7d74fd2452f79e38345eb
MD5 b48859adc8cedb352eb2da18d2fa1892
BLAKE2b-256 fcd3296cdeb19fb793533170fc205f58a2baceb791a00f307f8adfb5e33e24c8

See more details on using hashes here.

Supported by

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