syncthing-monitor/syncthing_monitor/syncthing_rest.py

12 lines
318 B
Python
Raw Normal View History

2021-01-28 13:31:25 +00:00
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"]