Skip to main content

Command-line interface for the Geopera geospatial data platform

Project description

geopera-cli

Command-line interface for the Geopera geospatial data platform.

geopera-cli is a thin auth + dispatch shell over the published geopera Python SDK. The only logic that lives in the CLI is authentication — the OAuth device flow, token refresh, and the choice between a Bearer token and an X-API-Key header. Every actual capability is reached through the generic API endpoint POST /v1/op/{operation_id}, so any of the ~227 operations is callable with no per-command code, and a new backend operation is instantly usable as geopera op <new.op> with zero CLI changes.

Install

pip install geopera-cli

This pulls in the geopera SDK, typer, and httpx.

Quick start

# Sign in (opens your browser; RFC 8628 device flow)
geopera login

# Who am I?
geopera whoami

# Price-preview an order (generic op dispatch)
geopera op orders.estimate '{"aoi": {...}, "product": "..."}'

# Search across every registered public data source
geopera op catalog.federated_search '{"bbox": [...], "datetime": "..."}'

# List every available operation id
geopera op --list

# Curated alias with table output
geopera orders list

Commands

Command Description
geopera login Device-flow login (default). --api-key KEY stores a key instead (- reads from stdin). --api-url URL, --no-browser, --scope.
geopera logout Clear the active profile's stored credentials (best-effort OAuth logout).
geopera whoami Show principal / org / scope (validates the session). --json for raw output.
geopera op OPERATION_ID [JSON] Generic operation dispatch. Body from positional arg, --file, or - (stdin). --list enumerates operations.
geopera orders list Curated alias over op orders.list with table formatting.

Global flags --profile NAME (env GEOPERA_PROFILE) and --api-url URL (env GEOPERA_API_URL) are accepted on every command.

Authentication

Device flow (default)

geopera login performs the OAuth 2.0 Device Authorization Grant (RFC 8628) with PKCE:

  1. Requests a device + user code from {api_url}/realms/public/protocol/openid-connect/auth/device.
  2. Prints the user code and opens the verification URL in your browser (skip with --no-browser).
  3. Polls the token endpoint until you approve, then stores the access and refresh tokens.

Access tokens are refreshed automatically — proactively when within 30s of expiry, and reactively on any 401 — using the stored refresh token. The backend rotates the refresh token, so both tokens are rewritten on each refresh.

API key (headless)

geopera login --api-key gpra_xxxxxxxx
# or, keeping the key out of shell history:
printf '%s' "$GEOPERA_KEY" | geopera login --api-key -

API keys are sent as X-API-Key, which the Geopera API accepts on every authenticated endpoint.

Profiles

Multiple identities are namespaced by profile:

geopera login --profile staging --api-url https://staging.api.geopera.com
geopera --help                      # default profile
GEOPERA_PROFILE=staging geopera whoami
geopera whoami --profile staging

Credential store

Credentials live in ~/.config/geopera/credentials.json (directory 0700, file 0600). Each top-level key is a profile:

{
  "default": {
    "api_url": "https://api.geopera.com",
    "auth": {
      "type": "oauth",
      "access_token": "...",
      "refresh_token": "...",
      "expires_at": 1750000000,
      "scope": "openid profile",
      "issuer": "https://api.geopera.com"
    }
  }
}

For an API key profile the auth block is {"type": "api_key", "api_key": "gpra_..."}.

Environment overrides

  • GEOPERA_API_URL — base URL override (below --api-url, above the stored value).
  • GEOPERA_PROFILE — active profile name.
  • GEOPERA_API_TOKEN — opaque bearer/API-key for ephemeral (e.g. CI) use, bypassing the store. A value starting with gpra_ is treated as an API key.

Configuration precedence

API base URL: --api-url flag → GEOPERA_API_URL → stored api_urlhttps://api.geopera.com.

License

MIT

Project details


Download files

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

Source Distribution

geopera_cli-0.2.0.tar.gz (46.3 kB view details)

Uploaded Source

Built Distribution

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

geopera_cli-0.2.0-py3-none-any.whl (50.3 kB view details)

Uploaded Python 3

File details

Details for the file geopera_cli-0.2.0.tar.gz.

File metadata

  • Download URL: geopera_cli-0.2.0.tar.gz
  • Upload date:
  • Size: 46.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for geopera_cli-0.2.0.tar.gz
Algorithm Hash digest
SHA256 760b19edb363ba6509b094c43c6ab4a427da85bc983e26d9a64841b976545425
MD5 d22741effae5ac151d934d8782c263cb
BLAKE2b-256 eec77c24563bb379c62b59497c2d501cb993151f36e4393d1b28bdca3ee32949

See more details on using hashes here.

Provenance

The following attestation bundles were made for geopera_cli-0.2.0.tar.gz:

Publisher: publish.yml on geo-pera/geopera-cli

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file geopera_cli-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: geopera_cli-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 50.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for geopera_cli-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 70535ce9331bd1b4da94229772002924b00571e8bc977222691c99b9102a09a2
MD5 dd6464a8e431e7af48bb0bd2efc15467
BLAKE2b-256 7774c13af054b6512a7a5edbad1239e89ea23139698e7724bfee77b877b57775

See more details on using hashes here.

Provenance

The following attestation bundles were made for geopera_cli-0.2.0-py3-none-any.whl:

Publisher: publish.yml on geo-pera/geopera-cli

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page