mirror of
https://github.com/uw935/vatsimfox.git
synced 2026-09-17 05:59:04 +00:00
first version
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
from flask import Flask, render_template, abort
|
||||
import requests
|
||||
|
||||
|
||||
app = Flask(__name__)
|
||||
|
||||
|
||||
@app.route("/")
|
||||
def index_page():
|
||||
return render_template("index.html")
|
||||
|
||||
|
||||
@app.errorhandler(404)
|
||||
def errorhandler_page(_):
|
||||
return render_template("4O4.html"), 404
|
||||
|
||||
|
||||
@app.route("/<int:cid>/")
|
||||
def viewer_page(cid):
|
||||
user = requests.get(f"https://api.vatsim.net/v2/members/{cid}").json()
|
||||
|
||||
if "detail" in user and user["detail"] == "Not Found":
|
||||
return abort(404)
|
||||
|
||||
return render_template("viewer.html", data=(user, ))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
app.run(debug=True)
|
||||
Reference in New Issue
Block a user