syncthing-monitor/syncthing_monitor/syncthing_rest.py
2021-01-28 15:33:21 +02:00

12 lines
318 B
Python

import json
import requests
from retrying import retry
@retry
def get_device_id(host, gui_port, api_key):
syncthing_headers = {'X-API-Key': api_key}
response = requests.get("http://" + host + ":" + gui_port + "/rest/system/status", headers=syncthing_headers)
return json.loads(response.content)["myID"]