Python API Client

The REST API for managing and accessing data from the Observatory Platform.

The observatory.api.client package is automatically generated by the OpenAPI Generator project:

  • API version: 1.0.0

  • Package version: 1.0.0

Requirements

Python >= 3.10

Installation & Usage

To install the package with PyPI:

pip install observatory-api

To install the package from source:

git clone https://github.com/The-Academic-Observatory/observatory-platform.git
cd observatory-platform
pip install -e observatory-api --constraint https://raw.githubusercontent.com/apache/airflow/constraints-2.7.3/constraints-no-providers-3.10.txt

Getting Started

In your own code, to use this library to connect and interact with client, you can run the following:


import time
import observatory.api.client
from pprint import pprint
from observatory.api.client.api import observatory_api
from observatory.api.client.model.dataset_release import DatasetRelease
# Defining the host is optional and defaults to https://localhost:5002
# See configuration.py for a list of all supported configuration parameters.
configuration = observatory.api.client.Configuration(
    host = "https://localhost:5002"
)

# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure API key authorization: api_key
configuration.api_key['api_key'] = 'YOUR_API_KEY'

# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['api_key'] = 'Bearer'


# Enter a context with an instance of the API client
with observatory.api.client.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = observatory_api.ObservatoryApi(api_client)
    id = 1 # int | DatasetRelease id

    try:
        # delete a DatasetRelease
        api_instance.delete_dataset_release(id)
    except observatory.api.client.ApiException as e:
        print("Exception when calling ObservatoryApi->delete_dataset_release: %s\n" % e)

Documentation for API Endpoints

All URIs are relative to https://localhost:5002

Class Method HTTP request Description
ObservatoryApi delete_dataset_release DELETE /v1/dataset_release delete a DatasetRelease
ObservatoryApi get_dataset_release GET /v1/dataset_release get a DatasetRelease
ObservatoryApi get_dataset_releases GET /v1/dataset_releases Get a list of DatasetRelease objects
ObservatoryApi post_dataset_release POST /v1/dataset_release create a DatasetRelease
ObservatoryApi put_dataset_release PUT /v1/dataset_release create or update a DatasetRelease

Documentation For Models

Documentation For Authorization

api_key

  • Type: API key

  • API key parameter name: key

  • Location: URL query string