How to authenticate with the API¶
All API clients require credentials. The SDK supports two authentication methods.
Token authentication (recommended)¶
Pass your API token when creating a client:
You can also pass a pre-built header dictionary:
Username and password authentication¶
Store credentials securely¶
Avoid hard-coding tokens in source files. Use environment variables instead:
import os
from owi.metadatabase.geometry.io import GeometryAPI
TOKEN = os.environ["OWI_API_TOKEN"]
api = GeometryAPI(token=TOKEN)
Warning
Never commit real API tokens to version control.