Background-Daemon/daemon.py

26 lines
466 B
Python
Executable File

#!/usr/bin/env python
import time
import requests
import config
from plugins import plugins
def emit(event, data):
json = {
"event": event,
"data": data
}
print(json)
return requests.post(config.OSD_URL, json=json)
def main():
data = requests.get(config.CAR_API_URL)
for plugin in plugins:
plugin.check(data.json(), emit)
if __name__ == "__main__":
while True:
main()
time.sleep(config.DELAY)