diff options
author | Daniel Friesel <derf@finalrewind.org> | 2021-03-27 15:01:29 +0100 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2021-03-27 15:01:29 +0100 |
commit | b9df4c4e63c0bf5c2f761386d8a7e7b3285b8a71 (patch) | |
tree | 33a42ad4bb33b92519cfab37a735f57e6d1f206d | |
parent | 08ba0611c2c6a0e022a9fd0aff6399c7b957a9e7 (diff) |
move train data to sub-dict in case of future expansions
-rwxr-xr-x | bin/efa-gw | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -42,14 +42,16 @@ async def handle_eva(request): ) as response: content = await response.text() content = json.loads(content) - reply = dict() + train_data = dict() for train in content["raw"]: if train["train_no"]: - reply[train["train_no"]] = { + train_data[train["train_no"]] = { "occupancy": get_occupancy(train["occupancy"]) } + reply = {"train": train_data} + return web.Response(body=json.dumps(reply), headers=headers) |