Live demo — data resets daily at 03:00 UTC. Nothing you enter is saved. Server UI →

Python Client API

Source: submodules/webapiclient-python/docs/ This file is a navigable summary. All detailed documentation lives in the source location above.


Package

pip install accordionq2

PyPI: accordionq2 Requires: Python 3.8+, no third-party dependencies (stdlib only: urllib, json, dataclasses)


Quick Start

from accordionq2 import AccordionQ2Client

with AccordionQ2Client("http://agent64.local:5000") as client:
    status = client.connection.get_status()
    temp = client.resources.get_value("TempRegulator.CPU_TEMP")
    print(f"Connected: {status.is_connected}, Temp: {temp}")

Constructor Parameters

Parameter Type Default Description
base_url str Base URL of the WebApi
timeout float 30.0 HTTP timeout in seconds

Use as a context manager (with block) for automatic cleanup, or call .close() manually.


API Groups

Group Property Description
connection client.connection Check hardware manager connectivity
resources client.resources Read/write hardware values
channels client.channels Configure multi-purpose I/O channels
modules client.modules Load/unload modules, hardware topology
application client.application Lifecycle, configuration files
media client.media Upload/download media files
calibration client.calibration Read/write calibration tables
comm client.comm Raw bus transactions (I2C, UART, SPI, Socket)
numeric_results client.numeric_results High-speed sampling & statistics

Method Summary

connection

status = client.connection.get_status()
# status.is_connected, status.last_error

resources

names  = client.resources.get_names()                   # list[str]
value  = client.resources.get_value("Voltage.VDD")      # str
client.resources.set_value("Output1", "2.5")
values = client.resources.get_values(["A", "B"])        # dict[str, str]
client.resources.set_values({"A": "1", "B": "2"})
resp   = client.resources.transact("Eeprom.Read", "0x0010")  # str

channels

all_ch = client.channels.get_all()                      # list[ChannelDto]
ch     = client.channels.get_channel(alias="MON_3V3")
client.channels.configure(ChannelConfigRequest(alias="MON_3V3", unit="V"))
client.channels.configure_many([...])

modules

all_m  = client.modules.get_all()                       # list[ModuleSettingsDto]
loaded = client.modules.get_loaded()
client.modules.load(module)
client.modules.unload(module)
system = client.modules.get_physical_system()           # PhysicalSystemDto
apps   = client.modules.get_licensed_apps()             # list[AppLicenseDto]

application

name   = client.application.get_name()
status = client.application.get_status()                # ModuleStatus enum
client.application.reset()
files  = client.application.list_config_files()         # list[str]
client.application.load_config_file("factory.cfg")
client.application.save_config_file("snapshot.cfg")
data   = client.application.download_config_file("factory.cfg")  # bytes
client.application.upload_config_file("factory.cfg", data)
client.application.delete_config_file("old.cfg")

media

files = client.media.list_files()                       # list[str]
data  = client.media.download_file("waveform.bin")      # bytes
client.media.upload_file("waveform.bin", data)
client.media.delete_file("old.bin")

comm (Bus Transactions)

from accordionq2.enums import BusActions

# I2C — data as bytes objects
resp = client.comm.i2c("0.ESH10000597.I2C00", address=0x50,
                       action=BusActions.SEND_RECEIVE,
                       data_to_send=bytes([0x00]),
                       number_of_bytes_to_receive=2)
# resp.received → bytes

# UART
resp = client.comm.uart("MyUart", action=BusActions.SEND_RECEIVE,
                        data_to_send=b"*IDN?\n", number_of_bytes_to_receive=64)

# SPI
resp = client.comm.spi("MySpi", action=BusActions.SEND_RECEIVE,
                       data_to_send=bytes([0xAA, 0xBB]), number_of_bytes_to_receive=2)

# Socket (TCP/IP)
resp = client.comm.socket("MySock", action=BusActions.SEND_RECEIVE,
                          host_name="192.168.1.10", port=5025,
                          data_to_send=b"*IDN?\n", number_of_bytes_to_receive=64)

Note: The Python client handles hex encoding/decoding automatically. You pass and receive bytes objects directly — no hex string manipulation required.

calibration

channels = client.calibration.get_channels()
table    = client.calibration.get_table(channels[0].net_name)
client.calibration.set_table(channels[0].net_name, updated)

numeric_results

channels = client.numeric_results.get_channels()
targets  = client.numeric_results.get_targets(channels[0].net_name)
meta = client.numeric_results.measure(
    channels[0].net_name, targets[0], samples=1000, reduced_set=True)
mean  = client.numeric_results.get_mean(channels[0].net_name)
stdev = client.numeric_results.get_stdev(channels[0].net_name)
raw   = client.numeric_results.get_samples(channels[0].net_name)  # reduced_set must be False

Error Handling

from accordionq2 import AccordionQ2ApiError

try:
    ch = client.channels.get_channel(alias="does.not.exist")
except AccordionQ2ApiError as e:
    print(f"HTTP {e.status_code}: {e}")
# Network errors: urllib.error.URLError
HTTP Cause
400 Invalid params; or get_samples() called after reduced_set=True
404 Channel / resource / file not found
500 Hardware manager error

.NET vs Python Comparison

Concept .NET Python
Client class AccordionQ2Client AccordionQ2Client
Group names PascalCase (.Resources) snake_case (.resources)
Method names PascalCase + Async suffix snake_case
Comm byte data Hex strings ("AABB") bytes objects
Error type AccordionQ2ApiException AccordionQ2ApiError
Async Yes (await) No (blocking)
Dependencies Newtonsoft.Json None (stdlib only)

Full comparison: dotnet-comparison.md


Full Documentation

An unhandled error has occurred. Reload 🗙

Rejoining the server...

Rejoin failed... trying again in seconds.

Failed to rejoin.
Please retry or reload the page.

The session has been paused by the server.

Failed to resume the session.
Please retry or reload the page.