mirror of https://github.com/nicolargo/glances.git
Correct issue with Restfull API top route
This commit is contained in:
parent
738775ab61
commit
6e95892e41
|
|
@ -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]
|
||||
|
||||
|
|
|
|||
|
|
@ -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',
|
||||
|
|
|
|||
Loading…
Reference in New Issue