def on_get(self, req, resp):
"""Return all datasets available on the service
:query boolean use_cache: False if cache must be reloaded, True if
values returned can be those cached.
:returns: A list with all datasets
"""
cache = req.get_param_as_bool("use_cache", blank_as_true=True)
dao = data_access.DatasetDAO()
listdts, err = dao.get_all_datasets(use_cache=cache)
if listdts is None:
raise falcon.HTTPNotFound(description=str(err))
response = [{"dataset": dtst.to_dict()} for dtst in listdts]
resp.body = json.dumps(response)
resp.content_type = 'application/json'
resp.status = falcon.HTTP_200
评论列表
文章目录