Skip to content

Authenticate

Obtain a token

Request an API token from the OWI Metadatabase administrator. The token grants read (and optionally write) access to the extension endpoints.

Pass the token to the API client

from owi.metadatabase.shm import ShmAPI

api = ShmAPI(
    api_root="https://owimetadatabase-dev.azurewebsites.net/api/v1",
    token="your-api-token",
)

Store the token in an environment variable

export OWI_METADATABASE_API_TOKEN="your-api-token"
import os
from owi.metadatabase.shm import ShmAPI

api = ShmAPI(token=os.environ["OWI_METADATABASE_API_TOKEN"])

Use a .env file

Create a .env file at the project root:

OWI_METADATABASE_API_TOKEN=your-api-token

Warning

Add .env to .gitignore to avoid committing secrets.