소스 검색

add an endpoint to get the airport information

Sven Czarnian 3 년 전
부모
커밋
d2b326fa9c
1개의 변경된 파일10개의 추가작업 그리고 0개의 파일을 삭제
  1. 10 0
      app.py

+ 10 - 0
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/<icao>')
 def configuration(icao):
     airport = aman.findAirport(icao.upper())