mirror of https://github.com/MISP/misp-modules
chg: [server] Cache module list JSON
parent
c6d5e19010
commit
8663db0152
|
@ -174,17 +174,22 @@ class ListModules(tornado.web.RequestHandler):
|
||||||
global loaded_modules
|
global loaded_modules
|
||||||
global mhandlers
|
global mhandlers
|
||||||
|
|
||||||
|
_cached_json = None
|
||||||
|
|
||||||
def get(self):
|
def get(self):
|
||||||
ret = []
|
if not self._cached_json:
|
||||||
for module_name in loaded_modules:
|
ret = []
|
||||||
ret.append({
|
for module_name in loaded_modules:
|
||||||
'name': module_name,
|
ret.append({
|
||||||
'type': mhandlers['type:' + module_name],
|
'name': module_name,
|
||||||
'mispattributes': mhandlers[module_name].introspection(),
|
'type': mhandlers['type:' + module_name],
|
||||||
'meta': mhandlers[module_name].version()
|
'mispattributes': mhandlers[module_name].introspection(),
|
||||||
})
|
'meta': mhandlers[module_name].version()
|
||||||
|
})
|
||||||
|
self._cached_json = json.dumps(ret)
|
||||||
|
|
||||||
log.debug('MISP ListModules request')
|
log.debug('MISP ListModules request')
|
||||||
self.write(json.dumps(ret))
|
self.write(self._cached_json)
|
||||||
|
|
||||||
|
|
||||||
class QueryModule(tornado.web.RequestHandler):
|
class QueryModule(tornado.web.RequestHandler):
|
||||||
|
|
Loading…
Reference in New Issue