Add timeout of 5s to monit api access ; per requests docs if you don't set this it will block indefinitely

This commit is contained in:
KemoNine 2020-08-22 17:02:10 -04:00
parent f58707010a
commit 9e2f369ad4

View file

@ -52,7 +52,8 @@ def getMonit():
for site in cf: for site in cf:
s = cf[site] s = cf[site]
r = requests.get(s['url'] + xmlQuery, r = requests.get(s['url'] + xmlQuery,
auth=(s['user'], s['passwd'])) auth=(s['user'], s['passwd']),
timeout=5)
allstat = json.loads(json.dumps(xmltodict.parse(r.text)['monit'])) allstat = json.loads(json.dumps(xmltodict.parse(r.text)['monit']))