glances_api 0.6.0__tar.gz → 0.7.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.
- {glances_api-0.6.0 → glances_api-0.7.0}/PKG-INFO +1 -1
- {glances_api-0.6.0 → glances_api-0.7.0}/glances_api/__init__.py +10 -2
- {glances_api-0.6.0 → glances_api-0.7.0}/pyproject.toml +1 -1
- {glances_api-0.6.0 → glances_api-0.7.0}/LICENSE +0 -0
- {glances_api-0.6.0 → glances_api-0.7.0}/README.rst +0 -0
- {glances_api-0.6.0 → glances_api-0.7.0}/glances_api/exceptions.py +0 -0
|
@@ -155,10 +155,18 @@ class Glances:
|
|
|
155
155
|
sensor_data["network"] = {}
|
|
156
156
|
for network in networks:
|
|
157
157
|
time_since_update = network["time_since_update"]
|
|
158
|
+
# New name of network sensors in Glances v4
|
|
159
|
+
rx = network.get("bytes_recv_rate_per_sec")
|
|
160
|
+
tx = network.get("bytes_sent_rate_per_sec")
|
|
161
|
+
# Compatibility with Glances v3
|
|
162
|
+
if rx is None and (rx_bytes := network.get("rx")) is not None:
|
|
163
|
+
rx = round(rx_bytes / time_since_update)
|
|
164
|
+
if tx is None and (tx_bytes := network.get("tx")) is not None:
|
|
165
|
+
tx = round(tx_bytes / time_since_update)
|
|
158
166
|
sensor_data["network"][network["interface_name"]] = {
|
|
159
167
|
"is_up": network.get("is_up"),
|
|
160
|
-
"rx":
|
|
161
|
-
"tx":
|
|
168
|
+
"rx": rx,
|
|
169
|
+
"tx": tx,
|
|
162
170
|
"speed": round(network["speed"] / 1024**3, 1),
|
|
163
171
|
}
|
|
164
172
|
data = self.data.get("dockers") or self.data.get("containers")
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[tool.poetry]
|
|
2
2
|
name = "glances_api"
|
|
3
|
-
version = "0.
|
|
3
|
+
version = "0.7.0"
|
|
4
4
|
description = "Python API for interacting with Glances"
|
|
5
5
|
authors = ["Fabian Affolter <fabian@affolter-engineering.ch>"]
|
|
6
6
|
homepage = "https://github.com/home-assistant-ecosystem/python-glances-api"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|