Skip to main content

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.

Metadata

Release files for terrakio-api 0.15.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for terrakio-api 0.15.0
File Size Uploaded Provenance Actions
terrakio_api-0.15.0.tar.gz 3.1 kB Without provenance Details for terrakio_api-0.15.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for terrakio-api 0.15.0
File Interpreter ABI Platform Actions
terrakio_api-0.15.0-py3-none-any.whl Python 3 none any Details for terrakio_api-0.15.0-py3-none-any.whl

Total release size: 5.9 kB

Release files / terrakio_api-0.15.0.tar.gz

Download URL terrakio_api-0.15.0.tar.gz
Size 3.1 kB
Tags Source
SHA-256 checksum
How to use checksums
59f28dce66c032bde3ff432b0c63359afd0746f99df6b71586282c1c4774304f
BLAKE2b-256 checksum
How to use checksums
19a8e807f2ae8f15dff8c001a254583a45e203c7a6bf9c9d5290f69c72567731
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.0 {"installer":{"name":"uv","version":"0.13.0","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.0-py3-none-any.whl

Download URL terrakio_api-0.15.0-py3-none-any.whl
Size 2.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4c17cf4253f090546751e3dbb2b6741cb47c26105de108d25c0af8c09db6ac68
BLAKE2b-256 checksum
How to use checksums
0ce2c44bbd9952e219ab07390adbe9ae5d17a29da7623afad77b096aa0ca9191
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.0 {"installer":{"name":"uv","version":"0.13.0","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.0

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.

Release history Release notifications | RSS feed

This release

0.15.0 This release

2 release files No provenance

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