def on_post(req, resp): falcon.after(crossdomain(req, resp)) result_dict = dict() try: resp.status = falcon.HTTP_200 data = json.loads(req.stream.read().decode('utf-8')) searchQuery = data.get('searchQuery') chartType = data.get('chartType') groupClass = data.get('groupClass') result = Search(searchQuery, chartType, groupClass) resp.body = json.dumps(result.get_chart()) # resp.content_type = "application/json" except Exception as e: print(e) result_dict["meta"] = { "html": "", "lang": "en", "report": "", "etag": "timestamp", "message": "OK" # ToDo Append ETAG (r&d req) } resp.body = json.dumps(result_dict)
def on_post(req, resp): falcon.after(crossdomain(req, resp)) result_dict = dict() try: resp.status = falcon.HTTP_200 data = json.loads(req.stream.read().decode('utf-8')) chartName = data.get('chartName') dashboardName = data.get('dashboardName') groupClass = data.get('groupClass') result = Dashboard.save_chart(chartName, dashboardName, groupClass) resp.body = json.dumps(result) # resp.content_type = "application/json" except Exception as e: print(e) result_dict["meta"] = { "html": "", "lang": "en", "report":"", "kpi":"", "kpi_name":"", "etag": "timestamp", "message": "OK" # ToDo Append ETAG (r&d req) } resp.body = json.dumps(result_dict)
def cache_control( directives: Sequence[str], when: Callable[[Request, Response], bool] = lambda _req, _resp: True, ): def add_header(req, resp, _resource): if when(req, resp): resp.cache_control = directives return after(add_header)