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://api-candidate.terrak.io (fronts all regions)
# or name an environment: Client(env="prod" | "candidate" | "dev" | "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.
Metadata
Release files for terrakio-api 0.15.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| terrakio_api-0.15.1.tar.gz | 3.1 kB | Without provenance | Details for terrakio_api-0.15.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| terrakio_api-0.15.1-py3-none-any.whl | Python 3 | none | any | Details for terrakio_api-0.15.1-py3-none-any.whl |
Total release size: 5.9 kB
Release files / terrakio_api-0.15.1.tar.gz
| Download URL | terrakio_api-0.15.1.tar.gz |
|---|---|
| Size | 3.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c4bf68c79c889b5bb2b7f9b15432e39d1d984d9288a291ed2521b5ca4e2d1f89
|
|
BLAKE2b-256 checksum How to use checksums |
31eabe11d2053739bd3f309a6dc239fe6da59c580ddb6fec1d45a0a9b9de6e47
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.13.5 {"installer":{"name":"uv","version":"0.13.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}
|
Release files / terrakio_api-0.15.1-py3-none-any.whl
| Download URL | terrakio_api-0.15.1-py3-none-any.whl |
|---|---|
| Size | 2.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1ce013b02d650f94a89eec36ae02fa6a4b062d9d9b9528f09a223b95b91144d2
|
|
BLAKE2b-256 checksum How to use checksums |
a19d0e04eacca7292c16574a47e780420a16ccd387a5755cceb5c338eeb2828c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.13.5 {"installer":{"name":"uv","version":"0.13.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}
|
Security for terrakio-api 0.15.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.