Python SDK

Many geospatial developers, including at SatVu, use tools available through the Python ecosystem, so we offer a Python SDK to simplify access to our RESTful APIs. The SDK handles authentication and API calls, allowing you to easily integrate our tools into yours.

Oil tanks - Lincoln County, Oklahoma, USA
Oil tanks - Lincoln County, Oklahoma, USA

The Python SDK project is published to the Python Package Index. Python SDK supports Python versions 3.8, 3.10 and 3.11.

Installation

You can install the Python SDK using pip. We recommend installing it in a virtual environment as shown below:

python -m venv sv-demo
. ./sv-demo/bin/activate
pip install satellitevu

Python SDK Authentication

To authenticate, you first need to retrieve the Client ID and Client Secret values from your user profile in the web application.

SatVu web application - profile page.
SatVu web application - profile page.

We recommend storing your API credentials as environment variables in your shell:

export SV_CLIENT_ID="Your Client ID"
export SV_CLIENT_SECRET="Your Secret"

Then you can import the required libraries and client credentials, and pass them to the Client:

# Importing libraries
import os
import satellitevu
 
# Reading credentials from the environment.
client_id = os.getenv("SV_CLIENT_ID")
client_secret = os.getenv("SV_CLIENT_SECRET")
 
# Checking if credentials are set.
if not client_id or not client_secret:
  raise RuntimeError("SV_CLIENT_ID and SV_CLIENT_SECRET must be set")
 
# Performing Authentication
client = satellitevu.Client(client_id=client_id, client_secret=client_secret)

The Client instance will automatically take care of obtaining an authorisation token and caching that token in your user cache directory, so you don’t need to implement OAuth2 flows yourself.

Listing contracts

Listing contracts is currently not supported by the Python SDK. For that, we recommend either getting your contract ID using the SatVu web application as described in Accessing SatVu platform or using RESTful API as described in RESTful API.

You need to provide your contract ID in every Python SDK request to access catalog or tasking flows.