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
- Groups and dataset sharing
Installation
pip install terrakio-api
Signing in
People log in; machines carry a key. Either credential works on every route.
from terrakio_api import 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
# A person: stores a session that renews itself, so this is a one-off.
client.auth.login(email="XXX", password="XXX")
# A service account or CI job: an API key, from the argument or TERRAKIO_API_KEY.
client = Client(api_key="tk_...")
An API key takes precedence over a session: TERRAKIO_API_KEY, then a stored key,
then the stored session. client.auth.view_api_key() is deprecated — it only ever
returns the legacy key, which accounts created since named keys landed do not have.
API keys
# Create a key (the full key is returned only here, so store it now)
new_key = client.keys.create_key(label="my laptop")
print(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.
Querying
from shapely.geometry import Point
dataset = client.geoquery(
expr="prec=MSWX.precipitation@(year=2024, month=1)\nprec",
feature=Point(149.057, -35.1548),
output="netcdf",
)
Groups and sharing
A group is a set of people you grant datasets to, rather than naming each person on each dataset.
group = client.groups.create_group(name="the-team")
client.groups.add_user_to_group(group=group["id"], emails=["colleague@example.com"])
# Grant a dataset to the group, or share it with one person
client.groups.add_group_to_dataset(dataset="Rainfall", id=group["id"])
client.groups.add_user_to_dataset(dataset="Rainfall", emails=["colleague@example.com"])
# See who reaches it: access level, groups (a null name is a deleted group), people
client.groups.get_dataset_access(dataset="Rainfall")
client.groups.list_groups() # groups you own
client.groups.list_groups(member=True) # plus the ones you belong to
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_api-0.13.0.tar.gz.
File metadata
- Download URL: terrakio_api-0.13.0.tar.gz
- Upload date:
- Size: 3.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
uv/0.12.13 {"installer":{"name":"uv","version":"0.12.13","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 |
81808aefdccba91ee41e8c5354b8837005befd33e8d8c909c248e2ef9aa9579d
|
|
| MD5 |
fe2aa37327ea88489c169875428200cf
|
|
| BLAKE2b-256 |
d8077d95006952dfb5395a60131e59d71de6f90d2f8708becde90164f6f091a9
|
File details
Details for the file terrakio_api-0.13.0-py3-none-any.whl.
File metadata
- Download URL: terrakio_api-0.13.0-py3-none-any.whl
- Upload date:
- Size: 2.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
uv/0.12.13 {"installer":{"name":"uv","version":"0.12.13","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 |
33ac1663dc85afdf463c831067179f6f80877d16802b62a9190e78e3685aa0fc
|
|
| MD5 |
611fa23f66c06fd55723114bd006c57a
|
|
| BLAKE2b-256 |
b47941a03e85d0be03540d3d04ebf8856f1cbcfd566b375750a912c288e124f0
|