Adrianux.net/app.py
ahoemann 16b7b2e0ba
All checks were successful
/ update (push) Successful in 0s
remove: unused variable; fix: debug mode off
2024-12-05 12:44:54 +01:00

39 lines
967 B
Python
Executable file

#!/usr/bin/env python3
from flask import Flask, render_template, redirect, url_for
import requests
app = Flask(__name__)
@app.route("/imprint")
def root():
return render_template("imprint.html")
@app.route("/about")
def about():
return render_template("about.html")
@app.route("/")
def homepage():
return render_template("homepage.html")
@app.route("/monitoring")
def monitoring():
git_status = get_status("https://git.adrianux.net")
website_status = get_status("https://adrianux.net")
return render_template("monitoring.html", git_status = git_status, website_status = website_status )
def get_status_code(link):
requested_site = requests.get(link)
return requested_site.status_code
def get_status(link):
match get_status_code(link):
case 200:
return "ONLINE"
case 500:
return "ERROR"
case _:
return "OFFLINE"
if __name__ == "__main__":
app.run(debug=False)