I am using a public API and the response im getting from the API is
<string xmlns="http://ws.sdde.bccr.fi.cr"><Datos_de_INGC011_CAT_INDICADORECONOMIC>
<INGC011_CAT_INDICADORECONOMIC>
<COD_INDICADORINTERNO>3148</COD_INDICADORINTERNO>
<DES_FECHA>2016-01-01T00:00:00-06:00</DES_FECHA>
<NUM_VALOR>533.00000000</NUM_VALOR>
</INGC011_CAT_INDICADORECONOMIC>
<INGC011_CAT_INDICADORECONOMIC>
<COD_INDICADORINTERNO>3148</COD_INDICADORINTERNO>
<DES_FECHA>2016-01-02T00:00:00-06:00</DES_FECHA>
<NUM_VALOR>533.00000000</NUM_VALOR>
</INGC011_CAT_INDICADORECONOMIC>
</Datos_de_INGC011_CAT_INDICADORECONOMIC></string>
I am trying to parse that XML using ElementTree but it is not working, my assumption is that its not working beacuse of the < and > that are in the response instead of <> but even after replacing the xml parser still doesnt work
Any ideas?
The code im using:
response = requests.get(url)
cleaned_data = response.text.replace('<','<')
cleaned_data = cleaned_data.replace('>','>')
tree = ET.fromstring(cleaned_data)
print(tree)