diff --git a/src/configuration.py b/src/configuration.py index 419e0f2c656c69869cf723a042c9e8bbc22d504f..d1aea27f5aa6d5d41a86a6d87311abb8657efecd 100644 --- a/src/configuration.py +++ b/src/configuration.py @@ -7,6 +7,11 @@ Created on: 16/01/2023 """ import math + +import json +import xmltodict + + import sys print(sys.path) from src import constants, utils @@ -102,21 +107,23 @@ def getconfigurationfile(cnx, request): city = request.args.get("city", default=None, type=str) if (city=="BIO"): fichero = open('kpis_bilbao.dex') - ret_json = fichero.read() + ret_xml = fichero.read() if (city=="AMS"): fichero = open('kpis_amsterdam.dex') - ret_json = fichero.read() - + ret_xml = fichero.read() + if (city=="HEL"): fichero = open('kpis_helsinki.dex') - ret_json = fichero.read() - + ret_xml = fichero.read() + if (city=="MES"): fichero = open('kpis_messina.dex') - ret_json = fichero.read() + ret_xml = fichero.read() + + data_dict = xmltodict.parse(ret_xml) + ret_json = json.dumps(data_dict) - return ret_json except: return constants.ERROR_EXCEPTION