What's the current best method for importing XML data - do I need to convert it into some other data format first?

https://www.met.ie/Open_Data/xml/county_forecast.xml

Hi. Am running some tests with the importation of XML data - link above - What’s the current best method for doing this? Should I convert the XML into some other data format first? Interested to hear what others are doing.

Thanks.

Depends what you want to do with it, but for me a 3rd party tool like xmltodict is pretty handy for converting it into a simpler object:

import streamlit as st
from xmltodict import parse
import requests

url = "https://www.met.ie/Open_Data/xml/county_forecast.xml"

data = requests.get(url).text

parsed_data = parse(data)

st.write(parsed_data)

Thanks for this. I went with the ‘IMPORTXML >> Google Sheets >> Streamlit’ route in the end.

1 Like