Update web.py
This commit is contained in:
parent
bd5d0f26e9
commit
b44f25fd74
1 changed files with 3 additions and 9 deletions
|
@ -60,13 +60,6 @@ class WatchState:
|
|||
ntfy_topic: str
|
||||
machine_number: str
|
||||
|
||||
def _to_dict(self) -> Dict[str, str]:
|
||||
return {
|
||||
"site_id": self.site_id,
|
||||
"ntfy_topic": self.ntfy_topic,
|
||||
"machine_number": self.machine_number,
|
||||
}
|
||||
|
||||
|
||||
jobs: List[WatchState] = []
|
||||
job_lock = Lock()
|
||||
|
@ -80,10 +73,11 @@ def _api_register_watcher(site_id: str) -> Union[any, Tuple[any, int]]:
|
|||
return flask.jsonify({"ok": False, "message": "missing machine_number"}), 400
|
||||
|
||||
job_lock.acquire()
|
||||
jobs.append(WatchState(site_id, ntfy_topic, machine_number))
|
||||
ws = WatchState(site_id, ntfy_topic, machine_number)
|
||||
jobs.append(ws)
|
||||
job_lock.release()
|
||||
|
||||
return "", 204
|
||||
return flask.jsonify(ws), 204
|
||||
|
||||
|
||||
def _api_list_watched() -> Union[any, Tuple[any, int]]:
|
||||
|
|
Reference in a new issue