syncthing-monitor/syncthing_monitor/config_xml.py

11 lines
311 B
Python
Raw Normal View History

2021-01-28 10:56:11 +00:00
from xml.etree import ElementTree as elementTree
def parse_api_key(xml_path='/config/config.xml'):
root = elementTree.parse(xml_path).getroot()
api_key = ''
for gui in root.findall('gui'):
# noinspection SpellCheckingInspection
api_key = gui.find('apikey').text
return api_key