def get_categories(request):
"""
Args:
request:
Returns:
the list of known categories in the configuration database
:Example:
curl -X GET http://localhost:8081/foglamp/categories
"""
# TODO: make it optimized and elegant
cf_mgr = ConfigurationManager(connect.get_storage())
categories = await cf_mgr.get_all_category_names()
categories_json = [{"key": c[0], "description": c[1]} for c in categories]
return web.json_response({'categories': categories_json})
评论列表
文章目录