Skip to main content

Official Python client for the UniServer API

Project description

UniServer Python Client

uniserver-client is the Python package for calling the UniServer API.

Install

pip install uniserver-client

Quick Start

from uniserver import UniServerClient

client = UniServerClient(
    base_url="https://uniserver-hyco.onrender.com",
    account_api_key="uacc_your_account_key"
)

# Create a project (client automatically remembers its first project API key)
project = client.create_project("my-project")
project_id = project["id"]

# KV operations
client.put_kv(project_id, "hello", {"message": "world"})
item = client.get_kv(project_id, "hello")
print(item)

# Object operations
client.put_object(
    project_id,
    item_key="model_cache",
    object_type="CacheBlob",
    serialized={"tokens": [1, 2, 3]},
    encoding="json",
)
print(client.list_objects(project_id))

Or with direct package-level functions:

import uniserver

uniserver.configure(
    base_url="https://uniserver-hyco.onrender.com",
    account_api_key="uacc_your_account_key",
)

project = uniserver.create_project("my-project")
project_id = project["id"]

# The first project key is remembered automatically
uniserver.put_kv(project_id, "hello", "world")
print(uniserver.get_kv(project_id, "hello"))

Auth Model

UniServer has two key types:

  • Account API key (X-Uniserver-Account-Key) for account/project operations.
  • Project API key (X-Project-Api-Key) for project data operations.

This package stores both in memory:

  • Account key: client.set_account_api_key(...)
  • Project key: client.set_project_api_key(project_id, ...)

You can still override per call:

client.list_kv(project_id=4, project_api_key="unis_project_key")

Environment Variables

If you do not pass values in code, the client can read:

  • UNISERVER_BASE_URL
  • UNISERVER_ACCOUNT_KEY

Main Methods

  • Health: health()
  • Accounts: create_account(), get_account(), create_account_api_key(), delete_account_api_key()
  • Projects: create_project(), list_projects(), get_project(), update_project(), delete_project()
  • Project keys: create_project_api_key(), delete_project_api_key()
  • KV: list_kv(), get_kv(), put_kv(), delete_kv()
  • Objects: list_objects(), get_object(), put_object(), delete_object()

Build a distributable package

python -m pip install build
python -m build

Built artifacts will be in dist/.

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

uniserver_client-0.1.0.tar.gz (9.2 kB view details)

Uploaded Source

Built Distribution

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

uniserver_client-0.1.0-py3-none-any.whl (8.0 kB view details)

Uploaded Python 3

File details

Details for the file uniserver_client-0.1.0.tar.gz.

File metadata

  • Download URL: uniserver_client-0.1.0.tar.gz
  • Upload date:
  • Size: 9.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for uniserver_client-0.1.0.tar.gz
Algorithm Hash digest
SHA256 b3353259488bcf9905330611e2e9d711bd7db5f17a14f8450ea7a30b6a5d9390
MD5 d16aecdc75ddf3cc9ad2d3d51df94df2
BLAKE2b-256 821469b708394ec278ebf3c83375a42b2b17cef4df416d3442bc864ec9a9b400

See more details on using hashes here.

File details

Details for the file uniserver_client-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for uniserver_client-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4c01ab9bc27f5a9150f3a26b610274f9f79fecd2a4bd7fe466e95e538bbfa77b
MD5 49c8a2c5bf1863594e5a7a25cc626d81
BLAKE2b-256 8f45c71cc6ca3cf4aa1aa33aea295bf970c4106551578f9b606322d72f2a0a07

See more details on using hashes here.

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