now-arriving/bom.py
2025-04-30 14:57:28 +10:00

16 lines
341 B
Python

from ftplib import FTP
import xml.etree.ElementTree as ET
ftp = FTP('ftp.bom.gov.au')
file = []
try:
ftp.login()
ftp.cwd('anon/gen/fwo')
ftp.retrbinary('RETR IDV17000.xml', file.append)
finally:
ftp.quit()
root = ET.fromstringlist(file)
print(root)
print([e.attrib['description'] for e in root.findall('./forecast/area')])