can parse api key
This commit is contained in:
@@ -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()
|
||||
@@ -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
|
||||
Reference in New Issue
Block a user