Correct issue with Restfull API top route

This commit is contained in:
nicolargo 2024-05-07 11:27:04 +02:00
parent 738775ab61
commit 6e95892e41
2 changed files with 4 additions and 2 deletions

View File

@ -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]

View File

@ -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',