Add more logging. Return json from get_data

This commit is contained in:
Ceda EI 2020-12-31 06:02:39 +05:30
parent 398f432e1a
commit a349a9f133
1 changed files with 4 additions and 2 deletions

View File

@ -17,7 +17,7 @@ class Daemon:
def get_data(self):
"Gets data from car api"
return requests.get(self.car_api)
return requests.get(self.car_api).json()
def emit(self, event, data):
"Events data to OSD Backend"
@ -25,13 +25,15 @@ class Daemon:
"event": event,
"data": data
}
print(json)
logging.info("Emitting to OSD Frontend")
logging.debug("%s", json)
return requests.post(self.osd_backend, json=json)
def check_all(self):
"Checks all the plugins"
data = self.get_data()
for plugin in self.plugins:
logging.debug("Checking plugin %s", plugin)
try:
plugin.check(data)
except Exception as error: # pylint: disable=broad-except