SDK Reference

KVNode includes a local Python configservice SDK at kvnode/sdk/python/configservice.py. It targets the same /v1/collections... REST API and replication stream used by the service.

Package

Language Package Notes
Python ConfigServiceClient from kvnode/sdk/python/configservice.py Local repository package, not a published external package

Connecting

1from configservice import ConfigServiceClient
2
3client = ConfigServiceClient(
4    base_url="https://api.hola.cloud",
5    mode="http",
6    node="sdk-python",
7)

Set

set sends POST /v1/collections/{collection}/keys/{key} with a JSON value and returns the write response.

1out = client.set("my-collection", "user:alice", {"role": "admin"})
2# {"ok": true, "seq": 1, "version": 1}

Get

1entry = client.get("my-collection", "user:alice")
2# {"key": "user:alice", "value": {"role": "admin"}, "version": 1, "updatedAt": "..."}

List Keys

1keys = client.list_keys("my-collection", prefix="user:", limit=100)
2# {"items": [...], "next": "..."}

Delete

1out = client.delete("my-collection", "user:alice")
2# {"ok": true, "seq": 2, "version": 2}

Replication Sync

sync reads POST /v1/replicate NDJSON and applies uppercase commands such as SET, DELETE, BASELINE_BEGIN, and BASELINE_END to the local in-memory view.

1client.sync()

Authentication

The service accepts requests when either X-Glue-Authentication is present or both apikey and secret are present. Missing authentication headers return 403 forbidden.

Comments

Leave a comment