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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file forester_client_http-0.6.0.tar.gz.
File metadata
- Download URL: forester_client_http-0.6.0.tar.gz
- Upload date:
- Size: 8.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
28661463b3750acb73df5f90c40195c7d5d1105ac396d314ec84c5d28324a781
|
|
| MD5 |
100766e80971f0573f4feeae6b465aae
|
|
| BLAKE2b-256 |
fe613baaa4870837cc74fa11834bcb51de11c804c0f36d575f82c2daff4bd8a4
|
File details
Details for the file forester_client_http-0.6.0-py3-none-any.whl.
File metadata
- Download URL: forester_client_http-0.6.0-py3-none-any.whl
- Upload date:
- Size: 9.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6565919c883de89aee8bd4b8710e19bb157d64140a71fe5ce7d5cbedc77405c4
|
|
| MD5 |
baefffe1ec42d06ea31dc851eb3e3537
|
|
| BLAKE2b-256 |
85ccd7ea7dd854467c1ceaeaaea6d98bd9d16d53605c4e8ab8360ccf0645d72d
|