can parse api key

This commit is contained in:
bj
2021-01-28 12:56:11 +02:00
parent 32799b65d5
commit 3c0eece311
15 changed files with 261 additions and 52 deletions
View File
+10
View File
@@ -0,0 +1,10 @@
from syncthing_monitor.config_xml import parse_api_key
def loop():
api_key = parse_api_key()
print("Found API Key: {0}".format(api_key))
if __name__ == "__main__":
loop()
+10
View File
@@ -0,0 +1,10 @@
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