Skip to main content

Forester HTTP client (Python)

Python client for the Forester HTTP API. Forester embeds a small HTTP server that exposes the blackboard and the tracer to remote actions. This package talks to that server.

The client is generated from the OpenAPI specification produced by the Forester gen-openapi binary (cargo run --bin gen-openapi). The source specification is kept in clients/http/openapi.json.

Installation

pip install forester-client-http

Usage

from forester_client_http import ForesterClient

client = ForesterClient("http://127.0.0.1:46123")

# health
print(client.health())  # "OK"

# blackboard
client.put("count", 42)
assert client.get("count") == 42
assert client.contains("count") is True

value = client.take("count")  # 42, and the key is removed

client.put("config", {"timeout": 5, "tags": ["a", "b"]})
client.lock("config")
assert client.is_locked("config") is True
client.unlock("config")

# tracer
client.trace("robot armed", tick=3)
print(client.print_trace())

API

Method Endpoint
health() GET /
openapi() GET /openapi.json
get(key) GET /bb/{key}
put(key, value) POST /bb/{key}
take(key) GET /bb/{key}/take
lock(key) GET /bb/{key}/lock
unlock(key) GET /bb/{key}/unlock
is_locked(key) GET /bb/{key}/locked
contains(key) GET /bb/{key}/contains
trace(text, tick) POST /tracer/custom
print_trace() GET /tracer/print

Development

pip install -e .[test]
pytest

License

Apache-2.0

Download files

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

Source Distribution

forester_client_http-0.6.1.tar.gz (10.5 kB view details)

Uploaded Source

Built Distribution

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

forester_client_http-0.6.1-py3-none-any.whl (11.3 kB view details)

Uploaded Python 3

File details

Details for the file forester_client_http-0.6.1.tar.gz.

File metadata

  • Download URL: forester_client_http-0.6.1.tar.gz
  • Upload date:
  • Size: 10.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.12.3

File hashes

Hashes for forester_client_http-0.6.1.tar.gz
Algorithm Hash digest
SHA256 15230b9de2260fcd0e81e846e6a1a8171625df0f25da10d51e085246f6a3a5ab
MD5 a956de57d2a1134e18c305e4f45324ad
BLAKE2b-256 6566b9a7d40ac9cf88513d562389a23d18ff8100b9d06cda09b582e7eb5b3ad5

See more details on using hashes here.

File details

Details for the file forester_client_http-0.6.1-py3-none-any.whl.

File metadata

File hashes

Hashes for forester_client_http-0.6.1-py3-none-any.whl
Algorithm Hash digest
SHA256 2189896da4968ed8443ce015c2e0f8d5df4f142ad93d4fbf0d584bdef081004b
MD5 cee6e59c3a9e0edc48807486d967cd96
BLAKE2b-256 d875e86c82df622474fb31ccb78cb3ac554b0fcf18f8f992ceed8c84909d21b4

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.6.1 This release

2 files

0.6.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