Skip to main content

Python client library for the Wisent Wire hardware testing platform API

Project description

Wisent Wire Python SDK

Python client library for the Wisent Wire hardware testing platform.

Installation

pip install wisent-wire-sdk

Quick start

from wisentwire import WisentWireClient

# Cognito auth (production / integration)
client = WisentWireClient(
    base_url="https://int.wisent-wire.com",
    email="user@company.com",
    password="secret",
)

# Local dev (header-based, no Cognito)
client = WisentWireClient(
    base_url="http://localhost:7998",
    email="dev@test.com",
    local=True,
)

# Pre-existing token
client = WisentWireClient(
    base_url="https://int.wisent-wire.com",
    token="eyJhbGciOi...",
)

Usage

Wires

wires = client.list_wires()
wire = client.get_wire(ww_id=1)

Power supply

client.set_power_supply(ww_id=1, state="ON", voltage=5.0, current=2.0)
shadow = client.wait_shadow_state(ww_id=1, expected_state="ON")
print(shadow.reported.voltage_setpoint)

Firmware & flash

fw = client.upload_firmware("app.bin", firmware_bytes, "STM32F4")
job_id = client.flash(ww_id=1, firmware_id=fw.id)
client.wait_flash_complete(ww_id=1, job_id=job_id)

UART

client.send_uart_ascii(ww_id=1, text="HELLO")
msg = client.wait_for_uart_rx(ww_id=1, match_hex="48454C4C4F")
print(msg.bytes_hex)

Telemetry

readings = client.get_power_telemetry(ww_id=1)

Reservations

reservations = client.list_reservations()

Organization

org = client.get_organization()
members = client.list_members()

Error handling

All API errors raise typed exceptions inheriting from WisentWireError:

from wisentwire import NotFoundError, ConflictError

try:
    client.get_wire(ww_id=999)
except NotFoundError as e:
    print(f"Wire not found: {e}")
HTTP status Exception
400 BadRequestError
401 AuthenticationError
403 ForbiddenError
404 NotFoundError
409 ConflictError
429 RateLimitError
503 ServiceUnavailableError

Development

pip install -e ".[dev]"
pytest tests/ -v

Requirements

  • Python >= 3.10
  • requests >= 2.28
  • tenacity >= 8.0

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

wisent_wire_sdk-0.1.0.tar.gz (26.3 kB view details)

Uploaded Source

Built Distribution

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

wisent_wire_sdk-0.1.0-py3-none-any.whl (30.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: wisent_wire_sdk-0.1.0.tar.gz
  • Upload date:
  • Size: 26.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for wisent_wire_sdk-0.1.0.tar.gz
Algorithm Hash digest
SHA256 b87ed31d48c2330bb5d1b896a80ed53f8017a2915b10a07cf15410d7866499f4
MD5 28fab4deed1e061c947389ebaef6e6b4
BLAKE2b-256 ce39ca13db9ca6f94613047e3690ddb6726db7459d01c9cf56771ed499ac845a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for wisent_wire_sdk-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e04b83de4589bc28f31f85054e7f788a88065e76c7bd3b9b189a5fb066cc443e
MD5 10261a5e52c6220617641ec560f247b1
BLAKE2b-256 7e57f79c5c5cb0ffe362bedfb7d3362ae6112a37715124ea8fad8c5eb7e33018

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