summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornicolargo <nicolashennion@gmail.com>2024-05-07 11:27:04 +0200
committernicolargo <nicolashennion@gmail.com>2024-05-07 11:27:04 +0200
commit6e95892e417726198530c3ecb126b197fdfd1a6a (patch)
treee565288eef5a3ba8edf1261a8bd3f6f44a3a344e
parent738775ab61060d36a3c808e8f4bb53c6b5f6c45a (diff)
Correct issue with Restfull API top route
-rw-r--r--glances/outputs/glances_restful_api.py4
-rwxr-xr-xunitest-restful.py2
2 files changed, 4 insertions, 2 deletions
diff --git a/glances/outputs/glances_restful_api.py b/glances/outputs/glances_restful_api.py
index b6afe8fd..5bde0ec6 100644
--- a/glances/outputs/glances_restful_api.py
+++ b/glances/outputs/glances_restful_api.py
@@ -512,12 +512,14 @@ class GlancesRestfulApi(object):
try:
# Get the RAW value of the stat ID
- statval = self.stats.get_plugin(plugin).get_export()
+ statval = self.stats.get_plugin(plugin).get_raw()
except Exception as e:
raise HTTPException(
status_code=status.HTTP_404_NOT_FOUND, detail="Cannot get plugin %s (%s)" % (plugin, str(e))
)
+ print(statval)
+
if isinstance(statval, list):
statval = statval[:nb]
diff --git a/unitest-restful.py b/unitest-restful.py
index faf1fe8f..bc2dc330 100755
--- a/unitest-restful.py
+++ b/unitest-restful.py
@@ -100,7 +100,7 @@ class TestGlances(unittest.TestCase):
print("HTTP RESTful request: %s/%s" % (URL, p))
req = self.http_get("%s/%s" % (URL, p))
self.assertTrue(req.ok)
- if p in ('uptime', 'now', 'version', 'psutilversion'):
+ if p in ('uptime', 'version', 'psutilversion'):
self.assertIsInstance(req.json(), text_type)
elif p in ('fs', 'percpu', 'sensors', 'alert', 'processlist', 'diskio',
'hddtemp', 'batpercent', 'network', 'folders', 'amps', 'ports',