Commit 67962c39 authored by Ralf's avatar Ralf
Browse files

log successful SpaceAPI updates

parent c04dff75
......@@ -27,7 +27,9 @@ class SpaceApi:
url = "https://spaceapi.hacksaar.de/status.php?action=update&key=%s&status=%d" % (spaceApiKey, state_val)
response = urllib.request.urlopen(url, timeout=5.0)
responseText = response.read().decode('utf-8').strip()
if response.getcode() == 200 and responseText == "UpdateSuccessful": return True
if response.getcode() == 200 and responseText == "UpdateSuccessful":
logger.debug("SpaceAPI: Update to {} successful".format(state_val))
return True
logger.error("SpaceAPI: returned unexpected code {}:\n{}".format(response.getcode(), responseText))
return False
except urllib.request.URLError as e:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment