Terrakio Admin API Client
Administrative API client for Terrakio services. This package extends the regular Terrakio API client with additional administrative capabilities.
Features
- All features from the regular API client
- User management (create, view, edit, delete users)
- Dataset management (create, edit, update, delete datasets)
- Mass stats functionality (create pyramid)
Installation
pip install terrakio-admin-api
Usage Example
from terrakio_admin_api import Client
# Initialize the admin client
admin_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 admin account
admin_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 = admin_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 = admin_client.keys.create_key(label="my laptop")
print(f"✓ New API key: {new_key['key']}")
# List keys (metadata only) and revoke one; pass uid=... to manage another account
for key in admin_client.keys.list_keys():
print(key["id"], key["prefix"], key["label"])
admin_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.
# List number of datasets
datasets = admin_client.datasets.list_datasets()
print(f"✓ Listed {len(datasets)} datasets")
# List number of users
users = admin_client.users.list_users()
print(f"✓ Listed {len(users)} users")
Writing a dataset
A dataset document states its kind — stored (data in a store), computed (an
input expression bound to a registry function) or loader (served by a loader
module). Storage presence says where a stored dataset is available: bucket for
the cloud, mount for the on-prem cluster, either or both. Pyramid settings go in
zoom, serve-time settings in serving, and the grid in grid.
admin_client.datasets.create_dataset(
name="Rainfall", kind="stored", products=["total"], dates=["2024-01-01"],
bucket="terrakio-mass-requests", path="rainfall/%s_%s_%03d_%03d_%02d.snp",
data_type="float32", no_data=-9999, x_size=400, y_size=400, i_max=10, j_max=10,
grid={"geotransform": geot, "proj4": proj4}, zoom={"max_zoom": 0},
)
admin_client.datasets.create_dataset(
name="ForestCNN", kind="computed", products=["prob"], dates=["2024-01-01"],
input="S2v2.red@(year={year})", function="forest_cnn", padding=16,
)
The payload is checked against the schema for its kind before the request, so an
off-schema or misplaced field is named locally. get_dataset and list_datasets
hand back this same shape whichever shape the service stores; pass raw=True for
the stored document verbatim.
For more documentation, see the main repository.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file terrakio_admin_api-0.9.0.tar.gz.
File metadata
- Download URL: terrakio_admin_api-0.9.0.tar.gz
- Upload date:
- Size: 16.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
20727c5d82c736e7b472405cc63e959e2870f2d01d76e68290a217f1ce5dcacf
|
|
| MD5 |
521b65943019867abd3a74cfd4b8ebe1
|
|
| BLAKE2b-256 |
6eb09207b3bb6349e0b67e577d5a85ea8feda5f6522f2eb06ae13bd65182bb0f
|
File details
Details for the file terrakio_admin_api-0.9.0-py3-none-any.whl.
File metadata
- Download URL: terrakio_admin_api-0.9.0-py3-none-any.whl
- Upload date:
- Size: 21.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d03670cba279bfd5aaaf50330af92e7339e66a6fed344de233db1dc18cc710fe
|
|
| MD5 |
b207b7f3f1ec50ba97b46507e13b3925
|
|
| BLAKE2b-256 |
44de90442c62b3a048d512c8270adc9230fa749a2e163f5fd062b620adaf6890
|