wisent-wire-sdk 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- wisent_wire_sdk-0.1.0/LICENSE +21 -0
- wisent_wire_sdk-0.1.0/PKG-INFO +149 -0
- wisent_wire_sdk-0.1.0/README.md +123 -0
- wisent_wire_sdk-0.1.0/pyproject.toml +55 -0
- wisent_wire_sdk-0.1.0/setup.cfg +4 -0
- wisent_wire_sdk-0.1.0/src/wisent_wire_sdk.egg-info/PKG-INFO +149 -0
- wisent_wire_sdk-0.1.0/src/wisent_wire_sdk.egg-info/SOURCES.txt +63 -0
- wisent_wire_sdk-0.1.0/src/wisent_wire_sdk.egg-info/dependency_links.txt +1 -0
- wisent_wire_sdk-0.1.0/src/wisent_wire_sdk.egg-info/requires.txt +9 -0
- wisent_wire_sdk-0.1.0/src/wisent_wire_sdk.egg-info/top_level.txt +1 -0
- wisent_wire_sdk-0.1.0/src/wisentwire/__init__.py +86 -0
- wisent_wire_sdk-0.1.0/src/wisentwire/_client_firmware.py +61 -0
- wisent_wire_sdk-0.1.0/src/wisentwire/_client_org.py +82 -0
- wisent_wire_sdk-0.1.0/src/wisentwire/_client_polling.py +107 -0
- wisent_wire_sdk-0.1.0/src/wisentwire/_client_resources.py +136 -0
- wisent_wire_sdk-0.1.0/src/wisentwire/auth.py +82 -0
- wisent_wire_sdk-0.1.0/src/wisentwire/auth_api/__init__.py +5 -0
- wisent_wire_sdk-0.1.0/src/wisentwire/auth_api/api.py +22 -0
- wisent_wire_sdk-0.1.0/src/wisentwire/auth_api/models.py +54 -0
- wisent_wire_sdk-0.1.0/src/wisentwire/client.py +177 -0
- wisent_wire_sdk-0.1.0/src/wisentwire/errors.py +106 -0
- wisent_wire_sdk-0.1.0/src/wisentwire/firmware/__init__.py +5 -0
- wisent_wire_sdk-0.1.0/src/wisentwire/firmware/api.py +55 -0
- wisent_wire_sdk-0.1.0/src/wisentwire/firmware/models.py +53 -0
- wisent_wire_sdk-0.1.0/src/wisentwire/flash/__init__.py +5 -0
- wisent_wire_sdk-0.1.0/src/wisentwire/flash/api.py +61 -0
- wisent_wire_sdk-0.1.0/src/wisentwire/flash/models.py +33 -0
- wisent_wire_sdk-0.1.0/src/wisentwire/frame_definitions/__init__.py +23 -0
- wisent_wire_sdk-0.1.0/src/wisentwire/frame_definitions/api.py +127 -0
- wisent_wire_sdk-0.1.0/src/wisentwire/frame_definitions/models.py +126 -0
- wisent_wire_sdk-0.1.0/src/wisentwire/organization/__init__.py +19 -0
- wisent_wire_sdk-0.1.0/src/wisentwire/organization/api.py +140 -0
- wisent_wire_sdk-0.1.0/src/wisentwire/organization/models.py +101 -0
- wisent_wire_sdk-0.1.0/src/wisentwire/reservations/__init__.py +5 -0
- wisent_wire_sdk-0.1.0/src/wisentwire/reservations/api.py +57 -0
- wisent_wire_sdk-0.1.0/src/wisentwire/reservations/models.py +37 -0
- wisent_wire_sdk-0.1.0/src/wisentwire/shadow/__init__.py +5 -0
- wisent_wire_sdk-0.1.0/src/wisentwire/shadow/api.py +44 -0
- wisent_wire_sdk-0.1.0/src/wisentwire/shadow/models.py +55 -0
- wisent_wire_sdk-0.1.0/src/wisentwire/telemetry/__init__.py +5 -0
- wisent_wire_sdk-0.1.0/src/wisentwire/telemetry/api.py +19 -0
- wisent_wire_sdk-0.1.0/src/wisentwire/telemetry/models.py +23 -0
- wisent_wire_sdk-0.1.0/src/wisentwire/uart/__init__.py +5 -0
- wisent_wire_sdk-0.1.0/src/wisentwire/uart/api.py +36 -0
- wisent_wire_sdk-0.1.0/src/wisentwire/uart/models.py +29 -0
- wisent_wire_sdk-0.1.0/src/wisentwire/wisentwires/__init__.py +5 -0
- wisent_wire_sdk-0.1.0/src/wisentwire/wisentwires/api.py +63 -0
- wisent_wire_sdk-0.1.0/src/wisentwire/wisentwires/models.py +40 -0
- wisent_wire_sdk-0.1.0/src/wisentwire/work_setup/__init__.py +5 -0
- wisent_wire_sdk-0.1.0/src/wisentwire/work_setup/api.py +76 -0
- wisent_wire_sdk-0.1.0/src/wisentwire/work_setup/models.py +35 -0
- wisent_wire_sdk-0.1.0/tests/test_auth.py +99 -0
- wisent_wire_sdk-0.1.0/tests/test_auth_api.py +71 -0
- wisent_wire_sdk-0.1.0/tests/test_errors.py +91 -0
- wisent_wire_sdk-0.1.0/tests/test_firmware.py +119 -0
- wisent_wire_sdk-0.1.0/tests/test_flash.py +178 -0
- wisent_wire_sdk-0.1.0/tests/test_frame_definitions.py +149 -0
- wisent_wire_sdk-0.1.0/tests/test_organization.py +194 -0
- wisent_wire_sdk-0.1.0/tests/test_polling.py +137 -0
- wisent_wire_sdk-0.1.0/tests/test_reservations.py +62 -0
- wisent_wire_sdk-0.1.0/tests/test_shadow.py +97 -0
- wisent_wire_sdk-0.1.0/tests/test_telemetry.py +52 -0
- wisent_wire_sdk-0.1.0/tests/test_uart.py +89 -0
- wisent_wire_sdk-0.1.0/tests/test_wisentwires.py +136 -0
- wisent_wire_sdk-0.1.0/tests/test_work_setup.py +107 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Wisent Wire
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: wisent-wire-sdk
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Python client library for the Wisent Wire hardware testing platform API
|
|
5
|
+
Author-email: Wisent Wire <info@wisent-wire.com>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Classifier: Development Status :: 3 - Alpha
|
|
8
|
+
Classifier: Intended Audience :: Developers
|
|
9
|
+
Classifier: Programming Language :: Python :: 3
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
14
|
+
Requires-Python: >=3.10
|
|
15
|
+
Description-Content-Type: text/markdown
|
|
16
|
+
License-File: LICENSE
|
|
17
|
+
Requires-Dist: requests>=2.28
|
|
18
|
+
Requires-Dist: tenacity>=8.0
|
|
19
|
+
Provides-Extra: dev
|
|
20
|
+
Requires-Dist: pytest>=7.0; extra == "dev"
|
|
21
|
+
Requires-Dist: responses>=0.23; extra == "dev"
|
|
22
|
+
Requires-Dist: ruff>=0.4; extra == "dev"
|
|
23
|
+
Requires-Dist: mypy>=1.10; extra == "dev"
|
|
24
|
+
Requires-Dist: types-requests>=2.28; extra == "dev"
|
|
25
|
+
Dynamic: license-file
|
|
26
|
+
|
|
27
|
+
# Wisent Wire Python SDK
|
|
28
|
+
|
|
29
|
+
Python client library for the [Wisent Wire](https://wisent-wire.com) hardware testing platform.
|
|
30
|
+
|
|
31
|
+
## Installation
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
pip install wisent-wire-sdk
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Quick start
|
|
38
|
+
|
|
39
|
+
```python
|
|
40
|
+
from wisentwire import WisentWireClient
|
|
41
|
+
|
|
42
|
+
# Cognito auth (production / integration)
|
|
43
|
+
client = WisentWireClient(
|
|
44
|
+
base_url="https://int.wisent-wire.com",
|
|
45
|
+
email="user@company.com",
|
|
46
|
+
password="secret",
|
|
47
|
+
)
|
|
48
|
+
|
|
49
|
+
# Local dev (header-based, no Cognito)
|
|
50
|
+
client = WisentWireClient(
|
|
51
|
+
base_url="http://localhost:7998",
|
|
52
|
+
email="dev@test.com",
|
|
53
|
+
local=True,
|
|
54
|
+
)
|
|
55
|
+
|
|
56
|
+
# Pre-existing token
|
|
57
|
+
client = WisentWireClient(
|
|
58
|
+
base_url="https://int.wisent-wire.com",
|
|
59
|
+
token="eyJhbGciOi...",
|
|
60
|
+
)
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## Usage
|
|
64
|
+
|
|
65
|
+
### Wires
|
|
66
|
+
|
|
67
|
+
```python
|
|
68
|
+
wires = client.list_wires()
|
|
69
|
+
wire = client.get_wire(ww_id=1)
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### Power supply
|
|
73
|
+
|
|
74
|
+
```python
|
|
75
|
+
client.set_power_supply(ww_id=1, state="ON", voltage=5.0, current=2.0)
|
|
76
|
+
shadow = client.wait_shadow_state(ww_id=1, expected_state="ON")
|
|
77
|
+
print(shadow.reported.voltage_setpoint)
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### Firmware & flash
|
|
81
|
+
|
|
82
|
+
```python
|
|
83
|
+
fw = client.upload_firmware("app.bin", firmware_bytes, "STM32F4")
|
|
84
|
+
job_id = client.flash(ww_id=1, firmware_id=fw.id)
|
|
85
|
+
client.wait_flash_complete(ww_id=1, job_id=job_id)
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### UART
|
|
89
|
+
|
|
90
|
+
```python
|
|
91
|
+
client.send_uart_ascii(ww_id=1, text="HELLO")
|
|
92
|
+
msg = client.wait_for_uart_rx(ww_id=1, match_hex="48454C4C4F")
|
|
93
|
+
print(msg.bytes_hex)
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### Telemetry
|
|
97
|
+
|
|
98
|
+
```python
|
|
99
|
+
readings = client.get_power_telemetry(ww_id=1)
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### Reservations
|
|
103
|
+
|
|
104
|
+
```python
|
|
105
|
+
reservations = client.list_reservations()
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
### Organization
|
|
109
|
+
|
|
110
|
+
```python
|
|
111
|
+
org = client.get_organization()
|
|
112
|
+
members = client.list_members()
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
## Error handling
|
|
116
|
+
|
|
117
|
+
All API errors raise typed exceptions inheriting from `WisentWireError`:
|
|
118
|
+
|
|
119
|
+
```python
|
|
120
|
+
from wisentwire import NotFoundError, ConflictError
|
|
121
|
+
|
|
122
|
+
try:
|
|
123
|
+
client.get_wire(ww_id=999)
|
|
124
|
+
except NotFoundError as e:
|
|
125
|
+
print(f"Wire not found: {e}")
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
| HTTP status | Exception |
|
|
129
|
+
|-------------|-------------------------|
|
|
130
|
+
| 400 | `BadRequestError` |
|
|
131
|
+
| 401 | `AuthenticationError` |
|
|
132
|
+
| 403 | `ForbiddenError` |
|
|
133
|
+
| 404 | `NotFoundError` |
|
|
134
|
+
| 409 | `ConflictError` |
|
|
135
|
+
| 429 | `RateLimitError` |
|
|
136
|
+
| 503 | `ServiceUnavailableError` |
|
|
137
|
+
|
|
138
|
+
## Development
|
|
139
|
+
|
|
140
|
+
```bash
|
|
141
|
+
pip install -e ".[dev]"
|
|
142
|
+
pytest tests/ -v
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
## Requirements
|
|
146
|
+
|
|
147
|
+
- Python >= 3.10
|
|
148
|
+
- `requests` >= 2.28
|
|
149
|
+
- `tenacity` >= 8.0
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
# Wisent Wire Python SDK
|
|
2
|
+
|
|
3
|
+
Python client library for the [Wisent Wire](https://wisent-wire.com) hardware testing platform.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pip install wisent-wire-sdk
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Quick start
|
|
12
|
+
|
|
13
|
+
```python
|
|
14
|
+
from wisentwire import WisentWireClient
|
|
15
|
+
|
|
16
|
+
# Cognito auth (production / integration)
|
|
17
|
+
client = WisentWireClient(
|
|
18
|
+
base_url="https://int.wisent-wire.com",
|
|
19
|
+
email="user@company.com",
|
|
20
|
+
password="secret",
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
# Local dev (header-based, no Cognito)
|
|
24
|
+
client = WisentWireClient(
|
|
25
|
+
base_url="http://localhost:7998",
|
|
26
|
+
email="dev@test.com",
|
|
27
|
+
local=True,
|
|
28
|
+
)
|
|
29
|
+
|
|
30
|
+
# Pre-existing token
|
|
31
|
+
client = WisentWireClient(
|
|
32
|
+
base_url="https://int.wisent-wire.com",
|
|
33
|
+
token="eyJhbGciOi...",
|
|
34
|
+
)
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Usage
|
|
38
|
+
|
|
39
|
+
### Wires
|
|
40
|
+
|
|
41
|
+
```python
|
|
42
|
+
wires = client.list_wires()
|
|
43
|
+
wire = client.get_wire(ww_id=1)
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### Power supply
|
|
47
|
+
|
|
48
|
+
```python
|
|
49
|
+
client.set_power_supply(ww_id=1, state="ON", voltage=5.0, current=2.0)
|
|
50
|
+
shadow = client.wait_shadow_state(ww_id=1, expected_state="ON")
|
|
51
|
+
print(shadow.reported.voltage_setpoint)
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### Firmware & flash
|
|
55
|
+
|
|
56
|
+
```python
|
|
57
|
+
fw = client.upload_firmware("app.bin", firmware_bytes, "STM32F4")
|
|
58
|
+
job_id = client.flash(ww_id=1, firmware_id=fw.id)
|
|
59
|
+
client.wait_flash_complete(ww_id=1, job_id=job_id)
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### UART
|
|
63
|
+
|
|
64
|
+
```python
|
|
65
|
+
client.send_uart_ascii(ww_id=1, text="HELLO")
|
|
66
|
+
msg = client.wait_for_uart_rx(ww_id=1, match_hex="48454C4C4F")
|
|
67
|
+
print(msg.bytes_hex)
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### Telemetry
|
|
71
|
+
|
|
72
|
+
```python
|
|
73
|
+
readings = client.get_power_telemetry(ww_id=1)
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### Reservations
|
|
77
|
+
|
|
78
|
+
```python
|
|
79
|
+
reservations = client.list_reservations()
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### Organization
|
|
83
|
+
|
|
84
|
+
```python
|
|
85
|
+
org = client.get_organization()
|
|
86
|
+
members = client.list_members()
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
## Error handling
|
|
90
|
+
|
|
91
|
+
All API errors raise typed exceptions inheriting from `WisentWireError`:
|
|
92
|
+
|
|
93
|
+
```python
|
|
94
|
+
from wisentwire import NotFoundError, ConflictError
|
|
95
|
+
|
|
96
|
+
try:
|
|
97
|
+
client.get_wire(ww_id=999)
|
|
98
|
+
except NotFoundError as e:
|
|
99
|
+
print(f"Wire not found: {e}")
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
| HTTP status | Exception |
|
|
103
|
+
|-------------|-------------------------|
|
|
104
|
+
| 400 | `BadRequestError` |
|
|
105
|
+
| 401 | `AuthenticationError` |
|
|
106
|
+
| 403 | `ForbiddenError` |
|
|
107
|
+
| 404 | `NotFoundError` |
|
|
108
|
+
| 409 | `ConflictError` |
|
|
109
|
+
| 429 | `RateLimitError` |
|
|
110
|
+
| 503 | `ServiceUnavailableError` |
|
|
111
|
+
|
|
112
|
+
## Development
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
pip install -e ".[dev]"
|
|
116
|
+
pytest tests/ -v
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
## Requirements
|
|
120
|
+
|
|
121
|
+
- Python >= 3.10
|
|
122
|
+
- `requests` >= 2.28
|
|
123
|
+
- `tenacity` >= 8.0
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=68.0", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "wisent-wire-sdk"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "Python client library for the Wisent Wire hardware testing platform API"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = "MIT"
|
|
11
|
+
requires-python = ">=3.10"
|
|
12
|
+
authors = [
|
|
13
|
+
{ name = "Wisent Wire", email = "info@wisent-wire.com" },
|
|
14
|
+
]
|
|
15
|
+
classifiers = [
|
|
16
|
+
"Development Status :: 3 - Alpha",
|
|
17
|
+
"Intended Audience :: Developers",
|
|
18
|
+
"Programming Language :: Python :: 3",
|
|
19
|
+
"Programming Language :: Python :: 3.10",
|
|
20
|
+
"Programming Language :: Python :: 3.11",
|
|
21
|
+
"Programming Language :: Python :: 3.12",
|
|
22
|
+
"Programming Language :: Python :: 3.13",
|
|
23
|
+
]
|
|
24
|
+
dependencies = [
|
|
25
|
+
"requests>=2.28",
|
|
26
|
+
"tenacity>=8.0",
|
|
27
|
+
]
|
|
28
|
+
|
|
29
|
+
[project.optional-dependencies]
|
|
30
|
+
dev = [
|
|
31
|
+
"pytest>=7.0",
|
|
32
|
+
"responses>=0.23",
|
|
33
|
+
"ruff>=0.4",
|
|
34
|
+
"mypy>=1.10",
|
|
35
|
+
"types-requests>=2.28",
|
|
36
|
+
]
|
|
37
|
+
|
|
38
|
+
[tool.setuptools.packages.find]
|
|
39
|
+
where = ["src"]
|
|
40
|
+
|
|
41
|
+
[tool.pytest.ini_options]
|
|
42
|
+
testpaths = ["tests"]
|
|
43
|
+
|
|
44
|
+
[tool.ruff]
|
|
45
|
+
target-version = "py310"
|
|
46
|
+
line-length = 99
|
|
47
|
+
|
|
48
|
+
[tool.ruff.lint]
|
|
49
|
+
select = ["E", "F", "W", "I", "UP", "B", "SIM", "RUF"]
|
|
50
|
+
|
|
51
|
+
[tool.mypy]
|
|
52
|
+
python_version = "3.10"
|
|
53
|
+
strict = true
|
|
54
|
+
packages = ["wisentwire"]
|
|
55
|
+
mypy_path = "src"
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: wisent-wire-sdk
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Python client library for the Wisent Wire hardware testing platform API
|
|
5
|
+
Author-email: Wisent Wire <info@wisent-wire.com>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Classifier: Development Status :: 3 - Alpha
|
|
8
|
+
Classifier: Intended Audience :: Developers
|
|
9
|
+
Classifier: Programming Language :: Python :: 3
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
14
|
+
Requires-Python: >=3.10
|
|
15
|
+
Description-Content-Type: text/markdown
|
|
16
|
+
License-File: LICENSE
|
|
17
|
+
Requires-Dist: requests>=2.28
|
|
18
|
+
Requires-Dist: tenacity>=8.0
|
|
19
|
+
Provides-Extra: dev
|
|
20
|
+
Requires-Dist: pytest>=7.0; extra == "dev"
|
|
21
|
+
Requires-Dist: responses>=0.23; extra == "dev"
|
|
22
|
+
Requires-Dist: ruff>=0.4; extra == "dev"
|
|
23
|
+
Requires-Dist: mypy>=1.10; extra == "dev"
|
|
24
|
+
Requires-Dist: types-requests>=2.28; extra == "dev"
|
|
25
|
+
Dynamic: license-file
|
|
26
|
+
|
|
27
|
+
# Wisent Wire Python SDK
|
|
28
|
+
|
|
29
|
+
Python client library for the [Wisent Wire](https://wisent-wire.com) hardware testing platform.
|
|
30
|
+
|
|
31
|
+
## Installation
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
pip install wisent-wire-sdk
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Quick start
|
|
38
|
+
|
|
39
|
+
```python
|
|
40
|
+
from wisentwire import WisentWireClient
|
|
41
|
+
|
|
42
|
+
# Cognito auth (production / integration)
|
|
43
|
+
client = WisentWireClient(
|
|
44
|
+
base_url="https://int.wisent-wire.com",
|
|
45
|
+
email="user@company.com",
|
|
46
|
+
password="secret",
|
|
47
|
+
)
|
|
48
|
+
|
|
49
|
+
# Local dev (header-based, no Cognito)
|
|
50
|
+
client = WisentWireClient(
|
|
51
|
+
base_url="http://localhost:7998",
|
|
52
|
+
email="dev@test.com",
|
|
53
|
+
local=True,
|
|
54
|
+
)
|
|
55
|
+
|
|
56
|
+
# Pre-existing token
|
|
57
|
+
client = WisentWireClient(
|
|
58
|
+
base_url="https://int.wisent-wire.com",
|
|
59
|
+
token="eyJhbGciOi...",
|
|
60
|
+
)
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## Usage
|
|
64
|
+
|
|
65
|
+
### Wires
|
|
66
|
+
|
|
67
|
+
```python
|
|
68
|
+
wires = client.list_wires()
|
|
69
|
+
wire = client.get_wire(ww_id=1)
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### Power supply
|
|
73
|
+
|
|
74
|
+
```python
|
|
75
|
+
client.set_power_supply(ww_id=1, state="ON", voltage=5.0, current=2.0)
|
|
76
|
+
shadow = client.wait_shadow_state(ww_id=1, expected_state="ON")
|
|
77
|
+
print(shadow.reported.voltage_setpoint)
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### Firmware & flash
|
|
81
|
+
|
|
82
|
+
```python
|
|
83
|
+
fw = client.upload_firmware("app.bin", firmware_bytes, "STM32F4")
|
|
84
|
+
job_id = client.flash(ww_id=1, firmware_id=fw.id)
|
|
85
|
+
client.wait_flash_complete(ww_id=1, job_id=job_id)
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### UART
|
|
89
|
+
|
|
90
|
+
```python
|
|
91
|
+
client.send_uart_ascii(ww_id=1, text="HELLO")
|
|
92
|
+
msg = client.wait_for_uart_rx(ww_id=1, match_hex="48454C4C4F")
|
|
93
|
+
print(msg.bytes_hex)
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### Telemetry
|
|
97
|
+
|
|
98
|
+
```python
|
|
99
|
+
readings = client.get_power_telemetry(ww_id=1)
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### Reservations
|
|
103
|
+
|
|
104
|
+
```python
|
|
105
|
+
reservations = client.list_reservations()
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
### Organization
|
|
109
|
+
|
|
110
|
+
```python
|
|
111
|
+
org = client.get_organization()
|
|
112
|
+
members = client.list_members()
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
## Error handling
|
|
116
|
+
|
|
117
|
+
All API errors raise typed exceptions inheriting from `WisentWireError`:
|
|
118
|
+
|
|
119
|
+
```python
|
|
120
|
+
from wisentwire import NotFoundError, ConflictError
|
|
121
|
+
|
|
122
|
+
try:
|
|
123
|
+
client.get_wire(ww_id=999)
|
|
124
|
+
except NotFoundError as e:
|
|
125
|
+
print(f"Wire not found: {e}")
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
| HTTP status | Exception |
|
|
129
|
+
|-------------|-------------------------|
|
|
130
|
+
| 400 | `BadRequestError` |
|
|
131
|
+
| 401 | `AuthenticationError` |
|
|
132
|
+
| 403 | `ForbiddenError` |
|
|
133
|
+
| 404 | `NotFoundError` |
|
|
134
|
+
| 409 | `ConflictError` |
|
|
135
|
+
| 429 | `RateLimitError` |
|
|
136
|
+
| 503 | `ServiceUnavailableError` |
|
|
137
|
+
|
|
138
|
+
## Development
|
|
139
|
+
|
|
140
|
+
```bash
|
|
141
|
+
pip install -e ".[dev]"
|
|
142
|
+
pytest tests/ -v
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
## Requirements
|
|
146
|
+
|
|
147
|
+
- Python >= 3.10
|
|
148
|
+
- `requests` >= 2.28
|
|
149
|
+
- `tenacity` >= 8.0
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
README.md
|
|
3
|
+
pyproject.toml
|
|
4
|
+
src/wisent_wire_sdk.egg-info/PKG-INFO
|
|
5
|
+
src/wisent_wire_sdk.egg-info/SOURCES.txt
|
|
6
|
+
src/wisent_wire_sdk.egg-info/dependency_links.txt
|
|
7
|
+
src/wisent_wire_sdk.egg-info/requires.txt
|
|
8
|
+
src/wisent_wire_sdk.egg-info/top_level.txt
|
|
9
|
+
src/wisentwire/__init__.py
|
|
10
|
+
src/wisentwire/_client_firmware.py
|
|
11
|
+
src/wisentwire/_client_org.py
|
|
12
|
+
src/wisentwire/_client_polling.py
|
|
13
|
+
src/wisentwire/_client_resources.py
|
|
14
|
+
src/wisentwire/auth.py
|
|
15
|
+
src/wisentwire/client.py
|
|
16
|
+
src/wisentwire/errors.py
|
|
17
|
+
src/wisentwire/auth_api/__init__.py
|
|
18
|
+
src/wisentwire/auth_api/api.py
|
|
19
|
+
src/wisentwire/auth_api/models.py
|
|
20
|
+
src/wisentwire/firmware/__init__.py
|
|
21
|
+
src/wisentwire/firmware/api.py
|
|
22
|
+
src/wisentwire/firmware/models.py
|
|
23
|
+
src/wisentwire/flash/__init__.py
|
|
24
|
+
src/wisentwire/flash/api.py
|
|
25
|
+
src/wisentwire/flash/models.py
|
|
26
|
+
src/wisentwire/frame_definitions/__init__.py
|
|
27
|
+
src/wisentwire/frame_definitions/api.py
|
|
28
|
+
src/wisentwire/frame_definitions/models.py
|
|
29
|
+
src/wisentwire/organization/__init__.py
|
|
30
|
+
src/wisentwire/organization/api.py
|
|
31
|
+
src/wisentwire/organization/models.py
|
|
32
|
+
src/wisentwire/reservations/__init__.py
|
|
33
|
+
src/wisentwire/reservations/api.py
|
|
34
|
+
src/wisentwire/reservations/models.py
|
|
35
|
+
src/wisentwire/shadow/__init__.py
|
|
36
|
+
src/wisentwire/shadow/api.py
|
|
37
|
+
src/wisentwire/shadow/models.py
|
|
38
|
+
src/wisentwire/telemetry/__init__.py
|
|
39
|
+
src/wisentwire/telemetry/api.py
|
|
40
|
+
src/wisentwire/telemetry/models.py
|
|
41
|
+
src/wisentwire/uart/__init__.py
|
|
42
|
+
src/wisentwire/uart/api.py
|
|
43
|
+
src/wisentwire/uart/models.py
|
|
44
|
+
src/wisentwire/wisentwires/__init__.py
|
|
45
|
+
src/wisentwire/wisentwires/api.py
|
|
46
|
+
src/wisentwire/wisentwires/models.py
|
|
47
|
+
src/wisentwire/work_setup/__init__.py
|
|
48
|
+
src/wisentwire/work_setup/api.py
|
|
49
|
+
src/wisentwire/work_setup/models.py
|
|
50
|
+
tests/test_auth.py
|
|
51
|
+
tests/test_auth_api.py
|
|
52
|
+
tests/test_errors.py
|
|
53
|
+
tests/test_firmware.py
|
|
54
|
+
tests/test_flash.py
|
|
55
|
+
tests/test_frame_definitions.py
|
|
56
|
+
tests/test_organization.py
|
|
57
|
+
tests/test_polling.py
|
|
58
|
+
tests/test_reservations.py
|
|
59
|
+
tests/test_shadow.py
|
|
60
|
+
tests/test_telemetry.py
|
|
61
|
+
tests/test_uart.py
|
|
62
|
+
tests/test_wisentwires.py
|
|
63
|
+
tests/test_work_setup.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
wisentwire
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
"""WisentWire Python SDK."""
|
|
2
|
+
|
|
3
|
+
from wisentwire._client_polling import FlashFailedError
|
|
4
|
+
from wisentwire.auth_api.models import MeOrganization, MeResponse, Role
|
|
5
|
+
from wisentwire.client import WisentWireClient
|
|
6
|
+
from wisentwire.errors import (
|
|
7
|
+
AuthenticationError,
|
|
8
|
+
BadRequestError,
|
|
9
|
+
ConflictError,
|
|
10
|
+
ForbiddenError,
|
|
11
|
+
NotFoundError,
|
|
12
|
+
RateLimitError,
|
|
13
|
+
ServiceUnavailableError,
|
|
14
|
+
WisentWireError,
|
|
15
|
+
)
|
|
16
|
+
from wisentwire.firmware.models import FirmwareBinary, FirmwareStatus, FirmwareUploadResponse
|
|
17
|
+
from wisentwire.flash.models import FlasherLogEntry, FlashJobStatus
|
|
18
|
+
from wisentwire.frame_definitions.models import (
|
|
19
|
+
ChecksumAlgorithm,
|
|
20
|
+
CommandDefinition,
|
|
21
|
+
CommandFieldValue,
|
|
22
|
+
ComputationType,
|
|
23
|
+
FieldCategory,
|
|
24
|
+
FieldDataType,
|
|
25
|
+
FrameDefinition,
|
|
26
|
+
FrameField,
|
|
27
|
+
)
|
|
28
|
+
from wisentwire.organization.models import (
|
|
29
|
+
Invitation,
|
|
30
|
+
MembershipRequest,
|
|
31
|
+
MembershipRole,
|
|
32
|
+
Organization,
|
|
33
|
+
OrgMember,
|
|
34
|
+
RequestStatus,
|
|
35
|
+
)
|
|
36
|
+
from wisentwire.reservations.models import Reservation
|
|
37
|
+
from wisentwire.shadow.models import LabTool, PowerSupplyConfig, PowerSupplyShadow
|
|
38
|
+
from wisentwire.telemetry.models import PowerSupplyTelemetryPoint
|
|
39
|
+
from wisentwire.uart.models import UartDirection, UartMessage
|
|
40
|
+
from wisentwire.wisentwires.models import WisentWire, WisentWireStatus
|
|
41
|
+
from wisentwire.work_setup.models import WorkSetup
|
|
42
|
+
|
|
43
|
+
__all__ = [
|
|
44
|
+
"AuthenticationError",
|
|
45
|
+
"BadRequestError",
|
|
46
|
+
"ChecksumAlgorithm",
|
|
47
|
+
"CommandDefinition",
|
|
48
|
+
"CommandFieldValue",
|
|
49
|
+
"ComputationType",
|
|
50
|
+
"ConflictError",
|
|
51
|
+
"FieldCategory",
|
|
52
|
+
"FieldDataType",
|
|
53
|
+
"FirmwareBinary",
|
|
54
|
+
"FirmwareStatus",
|
|
55
|
+
"FirmwareUploadResponse",
|
|
56
|
+
"FlashFailedError",
|
|
57
|
+
"FlashJobStatus",
|
|
58
|
+
"FlasherLogEntry",
|
|
59
|
+
"ForbiddenError",
|
|
60
|
+
"FrameDefinition",
|
|
61
|
+
"FrameField",
|
|
62
|
+
"Invitation",
|
|
63
|
+
"LabTool",
|
|
64
|
+
"MeOrganization",
|
|
65
|
+
"MeResponse",
|
|
66
|
+
"MembershipRequest",
|
|
67
|
+
"MembershipRole",
|
|
68
|
+
"NotFoundError",
|
|
69
|
+
"OrgMember",
|
|
70
|
+
"Organization",
|
|
71
|
+
"PowerSupplyConfig",
|
|
72
|
+
"PowerSupplyShadow",
|
|
73
|
+
"PowerSupplyTelemetryPoint",
|
|
74
|
+
"RateLimitError",
|
|
75
|
+
"RequestStatus",
|
|
76
|
+
"Reservation",
|
|
77
|
+
"Role",
|
|
78
|
+
"ServiceUnavailableError",
|
|
79
|
+
"UartDirection",
|
|
80
|
+
"UartMessage",
|
|
81
|
+
"WisentWire",
|
|
82
|
+
"WisentWireClient",
|
|
83
|
+
"WisentWireError",
|
|
84
|
+
"WisentWireStatus",
|
|
85
|
+
"WorkSetup",
|
|
86
|
+
]
|