Metadata-Version: 2.5
Name: terrakio-api
Version: 0.9.0
Summary: Client version of the terrakio-python-api
Requires-Python: >=3.11
Requires-Dist: terrakio-core==0.9.0
Description-Content-Type: text/markdown

# Terrakio API Client

A Python client for Terrakio API. This package provides a user-friendly interface for accessing Terrakio's data services.

## Features

- Authentication
- WCS queries and data retrieval
- Mass stats related functionalities

## Installation

```bash
pip install terrakio-api
```

## Usage Example

```python
from terrakio_api import Client
from shapely.geometry import Point

# Initialize the client
client = Client()  # defaults to https://dev-omni.terrak.io (fronts all regions)
# or name an environment: Client(env="prod" | "candidate" | "dev-au" | "local" | …),
# settable for a whole session with TERRAKIO_ENV

# Login to your account
client.auth.login(email = "XXX", password = "XXX")
print("✓ Login successful")

# The login account will automatically be used for the requests

# View API key
api_key = client.auth.view_api_key()
print(f"✓ Current API key: {api_key[:10]}...")

# Create an extra API key (the full key is returned only here, so store it now)
new_key = client.keys.create_key(label="my laptop")
print(f"✓ New API key: {new_key['key']}")

# List your keys (metadata only) and revoke one
for key in client.keys.list_keys():
    print(key["id"], key["prefix"], key["label"])
client.keys.revoke_key(key_id=new_key["id"])

# To rotate a key: create a new one, switch your code over to it, then revoke the old one.

# Create a geographic feature
point = Point(149.057, -35.1548)

# Make a WCS request
dataset = client.geoquery(
     expr="prec=MSWX.precipitation@(year=2024, month=1)\nprec",
     feature=point,
     output="netcdf"
)
```

For more documentation, see the [main repository](https://github.com/HaizeaAnalytics/terrakio-python-api). 