Use the Python client#
geonemo.client is the typed client of the REST API: one transport and credential set shared
by an attribute per capability.
Prerequisites#
Python 3.11 or later.
A server URL. Where the server requires sign-in, see Sign in and tokens after installing.
Install#
From a checkout of the repository:
pip install ./contracts/client
The distribution contains no database drivers, server framework or MCP tools. Optional
packs ship their own area clients, such as geonemo-maritime-client.
Connect#
from geonemo.client import GeoNeMoClient
with GeoNeMoClient(
"https://geonemo.example.com",
project_id="coastal-change",
) as client:
document = client.discover()
print(document.api_version, document.capabilities)
Argument |
Meaning |
|---|---|
|
Server origin; redirects are never followed |
|
Sent as |
|
Bearer token; without it the client uses the saved |
|
Seconds or an |
|
Your own |
Areas#
Attribute |
Guide |
|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Readiness, incidents and GPU status |
Errors#
Every failure raises an error derived from the client’s base error (ServicesClientError), which carries status_code,
retryable and operation. Messages never include URLs, headers or bodies.
Exception |
Raised for |
|---|---|
|
HTTP 400 or 422 |
|
HTTP 404 |
|
HTTP 409, including a reused idempotency key |
|
HTTP 408, 425, 429 and 5xx; |
|
The request timed out; a subclass of |
|
A success response broke the contract |
Test without a server#
FakeGeoNeMoClient mirrors .gkb, .catalog, .media and .status in memory.
from geonemo.client import CatalogRecord, FakeGeoNeMoClient
client = FakeGeoNeMoClient()
client.catalog.add_record(
CatalogRecord(id="preview-coast-001", collection="preview-imagery")
)
print(client.catalog.get_record("preview-imagery", "preview-coast-001").id)
Result#
Calls return typed models. See Python client for every class and method.