racs-python 0.0.1__tar.gz → 0.2.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.
- {racs_python-0.0.1 → racs_python-0.2.0}/PKG-INFO +48 -2
- racs_python-0.2.0/README.md +45 -0
- {racs_python-0.0.1 → racs_python-0.2.0}/pyproject.toml +2 -2
- {racs_python-0.0.1 → racs_python-0.2.0}/src/racs_python/client.py +12 -4
- {racs_python-0.0.1 → racs_python-0.2.0}/src/racs_python.egg-info/PKG-INFO +48 -2
- racs_python-0.0.1/README.md +0 -0
- {racs_python-0.0.1 → racs_python-0.2.0}/LICENSE +0 -0
- {racs_python-0.0.1 → racs_python-0.2.0}/setup.cfg +0 -0
- {racs_python-0.0.1 → racs_python-0.2.0}/src/racs_python/__init__.py +0 -0
- {racs_python-0.0.1 → racs_python-0.2.0}/src/racs_python/models.py +0 -0
- {racs_python-0.0.1 → racs_python-0.2.0}/src/racs_python.egg-info/SOURCES.txt +0 -0
- {racs_python-0.0.1 → racs_python-0.2.0}/src/racs_python.egg-info/dependency_links.txt +0 -0
- {racs_python-0.0.1 → racs_python-0.2.0}/src/racs_python.egg-info/requires.txt +0 -0
- {racs_python-0.0.1 → racs_python-0.2.0}/src/racs_python.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: racs-python
|
|
3
|
-
Version: 0.0
|
|
3
|
+
Version: 0.2.0
|
|
4
4
|
Summary: Client library to access racs api server
|
|
5
5
|
Author-email: Jonas Ahlf <javerik@javerik.space>
|
|
6
6
|
License: GNU GENERAL PUBLIC LICENSE
|
|
@@ -345,7 +345,7 @@ License: GNU GENERAL PUBLIC LICENSE
|
|
|
345
345
|
|
|
346
346
|
Project-URL: Homepage, https://codeberg.org/javerik/RACS-RustAravisCamServe
|
|
347
347
|
Project-URL: Bug Tracker, https://codeberg.org/javerik/RACS-RustAravisCamServe/issues
|
|
348
|
-
Keywords: racs,aravis,camera,client,api
|
|
348
|
+
Keywords: racs,aravis,camera,client,api,genicam,gev,gigevision
|
|
349
349
|
Classifier: Programming Language :: Python :: 3
|
|
350
350
|
Classifier: License :: OSI Approved :: GNU General Public License v2 (GPLv2)
|
|
351
351
|
Classifier: Operating System :: OS Independent
|
|
@@ -355,3 +355,49 @@ License-File: LICENSE
|
|
|
355
355
|
Requires-Dist: requests>=2.31
|
|
356
356
|
Requires-Dist: pydantic>=2.0
|
|
357
357
|
Dynamic: license-file
|
|
358
|
+
|
|
359
|
+
# RACS python client library
|
|
360
|
+
|
|
361
|
+
Simple client which uses `requests` to interact with the [racs-api server](https://codeberg.org/javerik/RACS-RustAravisCamServe).
|
|
362
|
+
|
|
363
|
+
## Install
|
|
364
|
+
|
|
365
|
+
```shell
|
|
366
|
+
pip install racs-python
|
|
367
|
+
```
|
|
368
|
+
|
|
369
|
+
## Usage
|
|
370
|
+
|
|
371
|
+
> **Make sure an instance of racs-api server is running**
|
|
372
|
+
|
|
373
|
+
```python
|
|
374
|
+
from racs_python import RacsClient
|
|
375
|
+
|
|
376
|
+
client = RacsClient("http://localhost:8742/api/v1")
|
|
377
|
+
|
|
378
|
+
# discover devices
|
|
379
|
+
devices = client.get_devices()
|
|
380
|
+
print(f"Found {len(devices.available)} available devices.")
|
|
381
|
+
|
|
382
|
+
if devices.available:
|
|
383
|
+
target_id = devices.available[0].id
|
|
384
|
+
|
|
385
|
+
# 2. Connection
|
|
386
|
+
client.connect_device(target_id)
|
|
387
|
+
print(f"Connected to device {target_id}")
|
|
388
|
+
|
|
389
|
+
# 3. Read/Write Settings
|
|
390
|
+
width = client.get_device_gc_node_value(target_id, "Width")
|
|
391
|
+
print(f"Current Width: {width}")
|
|
392
|
+
|
|
393
|
+
client.set_device_gc_node_value(target_id, "Width", "1920")
|
|
394
|
+
|
|
395
|
+
# 4. Grab an image
|
|
396
|
+
jpg_data = client.grab_jpg_frame(target_id)
|
|
397
|
+
with open("frame.jpg", "wb") as f:
|
|
398
|
+
f.write(jpg_data)
|
|
399
|
+
|
|
400
|
+
# 5. Cleanup
|
|
401
|
+
client.disconnect_device(target_id)
|
|
402
|
+
|
|
403
|
+
```
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# RACS python client library
|
|
2
|
+
|
|
3
|
+
Simple client which uses `requests` to interact with the [racs-api server](https://codeberg.org/javerik/RACS-RustAravisCamServe).
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```shell
|
|
8
|
+
pip install racs-python
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
> **Make sure an instance of racs-api server is running**
|
|
14
|
+
|
|
15
|
+
```python
|
|
16
|
+
from racs_python import RacsClient
|
|
17
|
+
|
|
18
|
+
client = RacsClient("http://localhost:8742/api/v1")
|
|
19
|
+
|
|
20
|
+
# discover devices
|
|
21
|
+
devices = client.get_devices()
|
|
22
|
+
print(f"Found {len(devices.available)} available devices.")
|
|
23
|
+
|
|
24
|
+
if devices.available:
|
|
25
|
+
target_id = devices.available[0].id
|
|
26
|
+
|
|
27
|
+
# 2. Connection
|
|
28
|
+
client.connect_device(target_id)
|
|
29
|
+
print(f"Connected to device {target_id}")
|
|
30
|
+
|
|
31
|
+
# 3. Read/Write Settings
|
|
32
|
+
width = client.get_device_gc_node_value(target_id, "Width")
|
|
33
|
+
print(f"Current Width: {width}")
|
|
34
|
+
|
|
35
|
+
client.set_device_gc_node_value(target_id, "Width", "1920")
|
|
36
|
+
|
|
37
|
+
# 4. Grab an image
|
|
38
|
+
jpg_data = client.grab_jpg_frame(target_id)
|
|
39
|
+
with open("frame.jpg", "wb") as f:
|
|
40
|
+
f.write(jpg_data)
|
|
41
|
+
|
|
42
|
+
# 5. Cleanup
|
|
43
|
+
client.disconnect_device(target_id)
|
|
44
|
+
|
|
45
|
+
```
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "racs-python"
|
|
7
|
-
version = "0.0
|
|
7
|
+
version = "0.2.0"
|
|
8
8
|
authors = [
|
|
9
9
|
{ name="Jonas Ahlf", email="javerik@javerik.space" },
|
|
10
10
|
]
|
|
@@ -25,7 +25,7 @@ classifiers = [
|
|
|
25
25
|
"Operating System :: OS Independent",
|
|
26
26
|
]
|
|
27
27
|
|
|
28
|
-
keywords = ["racs", "aravis", "camera", "client", "api"]
|
|
28
|
+
keywords = ["racs", "aravis", "camera", "client", "api", "genicam", "gev", "gigevision"]
|
|
29
29
|
|
|
30
30
|
[project.urls]
|
|
31
31
|
"Homepage" = "https://codeberg.org/javerik/RACS-RustAravisCamServe"
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import requests
|
|
2
|
-
from typing import List
|
|
2
|
+
from typing import List, Optional
|
|
3
3
|
from .models import DeviceConnections, GenICamNodeCategory
|
|
4
4
|
|
|
5
5
|
|
|
@@ -35,18 +35,24 @@ class RacsClient:
|
|
|
35
35
|
|
|
36
36
|
def get_devices(self) -> DeviceConnections:
|
|
37
37
|
"""
|
|
38
|
-
Discovers devices in network and shows connected devices.
|
|
38
|
+
Discovers devices in the network and shows connected devices.
|
|
39
39
|
GET /devices
|
|
40
40
|
"""
|
|
41
41
|
response = self._get("/devices")
|
|
42
42
|
return DeviceConnections.model_validate(response.json())
|
|
43
43
|
|
|
44
|
-
def connect_device(self, device_id: int) -> None:
|
|
44
|
+
def connect_device(self, device_id: int, ip: Optional[str] = None) -> None:
|
|
45
45
|
"""
|
|
46
46
|
Connect to a specific device.
|
|
47
|
+
|
|
48
|
+
Can connect to a device by specifying the IP address. The device_id has to be set as well, which will is needed for later operations.
|
|
49
|
+
|
|
47
50
|
PUT /devices/{id}/connect
|
|
48
51
|
"""
|
|
49
|
-
|
|
52
|
+
if ip is not None:
|
|
53
|
+
self._put(f"/devices/{device_id}/connect", params={"ip": ip})
|
|
54
|
+
else:
|
|
55
|
+
self._put(f"/devices/{device_id}/connect")
|
|
50
56
|
|
|
51
57
|
def disconnect_device(self, device_id: int) -> None:
|
|
52
58
|
"""
|
|
@@ -100,6 +106,8 @@ class RacsClient:
|
|
|
100
106
|
def grab_jpg_frame(self, device_id: int) -> bytes:
|
|
101
107
|
"""
|
|
102
108
|
Grab a single frame as JPEG.
|
|
109
|
+
|
|
110
|
+
PixelFormat is automatically set to MONO_8
|
|
103
111
|
GET /devices/{id}/stream/frame/jpeg
|
|
104
112
|
"""
|
|
105
113
|
response = self._get(f"/devices/{device_id}/stream/frame/jpeg")
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: racs-python
|
|
3
|
-
Version: 0.0
|
|
3
|
+
Version: 0.2.0
|
|
4
4
|
Summary: Client library to access racs api server
|
|
5
5
|
Author-email: Jonas Ahlf <javerik@javerik.space>
|
|
6
6
|
License: GNU GENERAL PUBLIC LICENSE
|
|
@@ -345,7 +345,7 @@ License: GNU GENERAL PUBLIC LICENSE
|
|
|
345
345
|
|
|
346
346
|
Project-URL: Homepage, https://codeberg.org/javerik/RACS-RustAravisCamServe
|
|
347
347
|
Project-URL: Bug Tracker, https://codeberg.org/javerik/RACS-RustAravisCamServe/issues
|
|
348
|
-
Keywords: racs,aravis,camera,client,api
|
|
348
|
+
Keywords: racs,aravis,camera,client,api,genicam,gev,gigevision
|
|
349
349
|
Classifier: Programming Language :: Python :: 3
|
|
350
350
|
Classifier: License :: OSI Approved :: GNU General Public License v2 (GPLv2)
|
|
351
351
|
Classifier: Operating System :: OS Independent
|
|
@@ -355,3 +355,49 @@ License-File: LICENSE
|
|
|
355
355
|
Requires-Dist: requests>=2.31
|
|
356
356
|
Requires-Dist: pydantic>=2.0
|
|
357
357
|
Dynamic: license-file
|
|
358
|
+
|
|
359
|
+
# RACS python client library
|
|
360
|
+
|
|
361
|
+
Simple client which uses `requests` to interact with the [racs-api server](https://codeberg.org/javerik/RACS-RustAravisCamServe).
|
|
362
|
+
|
|
363
|
+
## Install
|
|
364
|
+
|
|
365
|
+
```shell
|
|
366
|
+
pip install racs-python
|
|
367
|
+
```
|
|
368
|
+
|
|
369
|
+
## Usage
|
|
370
|
+
|
|
371
|
+
> **Make sure an instance of racs-api server is running**
|
|
372
|
+
|
|
373
|
+
```python
|
|
374
|
+
from racs_python import RacsClient
|
|
375
|
+
|
|
376
|
+
client = RacsClient("http://localhost:8742/api/v1")
|
|
377
|
+
|
|
378
|
+
# discover devices
|
|
379
|
+
devices = client.get_devices()
|
|
380
|
+
print(f"Found {len(devices.available)} available devices.")
|
|
381
|
+
|
|
382
|
+
if devices.available:
|
|
383
|
+
target_id = devices.available[0].id
|
|
384
|
+
|
|
385
|
+
# 2. Connection
|
|
386
|
+
client.connect_device(target_id)
|
|
387
|
+
print(f"Connected to device {target_id}")
|
|
388
|
+
|
|
389
|
+
# 3. Read/Write Settings
|
|
390
|
+
width = client.get_device_gc_node_value(target_id, "Width")
|
|
391
|
+
print(f"Current Width: {width}")
|
|
392
|
+
|
|
393
|
+
client.set_device_gc_node_value(target_id, "Width", "1920")
|
|
394
|
+
|
|
395
|
+
# 4. Grab an image
|
|
396
|
+
jpg_data = client.grab_jpg_frame(target_id)
|
|
397
|
+
with open("frame.jpg", "wb") as f:
|
|
398
|
+
f.write(jpg_data)
|
|
399
|
+
|
|
400
|
+
# 5. Cleanup
|
|
401
|
+
client.disconnect_device(target_id)
|
|
402
|
+
|
|
403
|
+
```
|
racs_python-0.0.1/README.md
DELETED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|