Skip to content

Python connector

The Python connector enables users to interact with OKAPI:Aether from within their own Python code. We recommend using the package provided via PyPI (see below), as it is updated with every release of OKAPI and actively maintained.

This page provides a guide to the recommended installation of the package. We strongly recommend following the steps outlined to ensure a functional setup.

Getting started

Creating a virtual environment

It is recommended to create a new dedicated virtual environment inside the project folder to avoid compatibility issues between different package versions. To do so, navigate inside your project folder and use the following command:

python3 -m venv .venv

To activate your virtual environment, use the command below for macOS and Linux-based systems:

source .venv/bin/activate

On Windows, run the following command depending on your CLI:

  .venv\Scripts\activate.bat
  .venv\Scripts\activate.ps1

Your virtual environment is now ready to be used. Note that it contains no packages, so you would have to install all packages required for your own project. At the end of your work, you may deactivate the current virtual environment with:

deactivate

For more details on setting up a virtual environment, you can find information here.

Installing the connector using PIP

Once inside the relevant directory with an active virtual environment, the okapi-aether-sdk package can be installed with the following command:

pip install okapi-aether-sdk

Setting authentication with env variables

To use the API you must set up your authentication credentials. Authentication might be set up via:

  • Passing directly user credentials to the login method (add a reference to the section from aether_api)
  • Setting directly env variables AETHER_AUTH0_USERNAME, AETHER_AUTH0_PASSWORD
  • Using an .env file with the previously mentioned en variables.
    AETHER_AUTH0_USERNAME=user@example.com
    AETHER_AUTH0_PASSWORD=AGreatPasswordToEnsureYourSecurity!
    

Package overview

The okapi-aether-sdk package can broadly be divided into two main categories:

  • The low level package AetherApi contains base functionalities to interact with the API, such as logging in, sending and receiving requests and handling errors.
  • The high level packages Services, Satellites, and Sensors, which inherit the base class AetherApi. Essentially, each of these constitute a helper method to directly use specific endpoints.

The following pages provide example Jupyter Notebooks illustrating the use of the okapi-aether-sdk package: