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.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

terrakio_api-0.13.0.tar.gz (3.1 kB view details)

Uploaded Source

Built Distribution

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

terrakio_api-0.13.0-py3-none-any.whl (2.8 kB view details)

Uploaded Python 3

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

Hashes for terrakio_api-0.13.0.tar.gz
Algorithm Hash digest
SHA256 81808aefdccba91ee41e8c5354b8837005befd33e8d8c909c248e2ef9aa9579d
MD5 fe2aa37327ea88489c169875428200cf
BLAKE2b-256 d8077d95006952dfb5395a60131e59d71de6f90d2f8708becde90164f6f091a9

See more details on using hashes here.

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

Hashes for terrakio_api-0.13.0-py3-none-any.whl
Algorithm Hash digest
SHA256 33ac1663dc85afdf463c831067179f6f80877d16802b62a9190e78e3685aa0fc
MD5 611fa23f66c06fd55723114bd006c57a
BLAKE2b-256 b47941a03e85d0be03540d3d04ebf8856f1cbcfd566b375750a912c288e124f0

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.13.0 This release

2 files

0.12.0

2 files

0.11.0

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

0.1.8

2 files

0.1.7

2 files

0.1.6

2 files

0.1.4

2 files

0.1.3

2 files

0.1.2

2 files

0.1.1

2 files

0.1.0

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