From d2b326fa9cd540dca420affcbb1b6f7591b0be6c Mon Sep 17 00:00:00 2001 From: Sven Czarnian Date: Thu, 18 Nov 2021 08:47:09 +0100 Subject: [PATCH] add an endpoint to get the airport information --- app.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/app.py b/app.py index 43daa6d..f36a1d7 100644 --- a/app.py +++ b/app.py @@ -29,6 +29,16 @@ app = Flask('AMAN') if __name__ == '__main__': app.run() +@app.route('/aman/airports') +def airports(): + retval = [] + + for airport in aman.Workers: + retval.append(airport.Icao) + + data = json.dumps(retval, ensure_ascii=True) + return Response(data, status=200, mimetype='application/json') + @app.route('/aman/configuration/') def configuration(icao): airport = aman.findAirport(icao.upper())