Skip to main content

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 kindstored (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

terrakio_admin_api-0.11.0.tar.gz (16.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

terrakio_admin_api-0.11.0-py3-none-any.whl (22.2 kB view details)

Uploaded Python 3

File details

Details for the file terrakio_admin_api-0.11.0.tar.gz.

File metadata

  • Download URL: terrakio_admin_api-0.11.0.tar.gz
  • Upload date:
  • Size: 16.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.6 {"installer":{"name":"uv","version":"0.12.6","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

Hashes for terrakio_admin_api-0.11.0.tar.gz
Algorithm Hash digest
SHA256 c365781ca130fc53783f462a198883e469907b870365df743d4d09367aa92c3b
MD5 ff2355ce094ed0a432f74317070a953f
BLAKE2b-256 1d27fb7e1cc28508b7660988004c077a564d2e797371ef8ef439cd592a518ee9

See more details on using hashes here.

File details

Details for the file terrakio_admin_api-0.11.0-py3-none-any.whl.

File metadata

  • Download URL: terrakio_admin_api-0.11.0-py3-none-any.whl
  • Upload date:
  • Size: 22.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.6 {"installer":{"name":"uv","version":"0.12.6","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

Hashes for terrakio_admin_api-0.11.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7e81b623c78a9d0e4a97efbcb97e718a652933bd7bda9b6dad7b08640d2caa6c
MD5 bbb68a687882e299627308214c87f502
BLAKE2b-256 b1010ae8d7e70a45d75e174cfd7f3ba8cf6175800a8b6637f90d6632147c9757

See more details on using hashes here.

Release history Release notifications | RSS feed

0.13.0

2 files

0.12.0

2 files

This release

0.11.0 This release

2 files

0.10.0

2 files

0.9.4

2 files

0.9.3

2 files

0.9.2

2 files

0.9.1

2 files

0.9.0

2 files

0.8.0

2 files

0.7.4

2 files

0.7.3

2 files

0.7.2

2 files

0.7.1

2 files

0.7.0

2 files

0.6.7

2 files

0.6.6

2 files

0.6.5

2 files

0.6.4

2 files

0.6.3

2 files

0.6.2

2 files

0.6.1

2 files

0.6.0

2 files

0.5.24

2 files

0.5.23

2 files

0.5.22

2 files

0.5.21

2 files

0.5.20

2 files

0.5.19

2 files

0.5.18

2 files

0.5.17

2 files

0.5.16

2 files

0.5.15

2 files

0.5.14

2 files

0.5.13

2 files

0.5.12

2 files

0.5.11

2 files

0.5.10

2 files

0.5.9

2 files

0.5.8

2 files

0.5.7

2 files

0.5.5

2 files

0.5.4

2 files

0.5.3.1

2 files

0.5.3

2 files

0.5.2

2 files

0.5.1

2 files

0.5.0

2 files

0.4.98

2 files

0.4.97

2 files

0.4.96

2 files

0.4.95

2 files

0.4.94

2 files

0.4.93

2 files

0.4.8

2 files

0.4.7

2 files

0.4.6

2 files

0.4.5

2 files

0.4.4

2 files

0.4.3

2 files

0.4.2

2 files

0.4.0

2 files

0.3.9

2 files

0.3.8

2 files

0.3.7

2 files

0.3.6

2 files

0.3.4

2 files

0.3.3

2 files

0.3.2

2 files

0.3.1

2 files

0.3.0

2 files

0.2.8

2 files

0.2.7

2 files

0.2.6

2 files

0.2.4

2 files

0.2.3

2 files

0.2.2

2 files

0.2.1

2 files

0.2.0

2 files

0.1.9

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page