Compare commits
No commits in common. "5d70db12b8965db5ed2697ae061199c6f9f14a15" and "d98e9767d30d6705b4ed3e159e52e0c48c7aa4ed" have entirely different histories.
5d70db12b8
...
d98e9767d3
2 changed files with 0 additions and 33 deletions
24
app.py
24
app.py
|
@ -1,7 +1,5 @@
|
|||
#!/usr/bin/env python3
|
||||
from flask import Flask, render_template, redirect, url_for
|
||||
import requests
|
||||
|
||||
app = Flask(__name__)
|
||||
navigation = {"Imprint":"imprint"}
|
||||
@app.route("/imprint")
|
||||
|
@ -16,27 +14,5 @@ def about():
|
|||
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:
|
||||
print(200)
|
||||
return "ONLINE"
|
||||
case 500:
|
||||
print(500)
|
||||
return "ERROR"
|
||||
case _:
|
||||
print("OTHER")
|
||||
return "OFFLINE"
|
||||
|
||||
if __name__ == "__main__":
|
||||
app.run(debug=True)
|
||||
|
|
|
@ -1,9 +0,0 @@
|
|||
{% extends "base.html" %}
|
||||
{% block title %}Monitoring{% endblock %}
|
||||
{% block head %}
|
||||
{{ super() }}
|
||||
{% endblock %}
|
||||
{% block content %}
|
||||
<p>Git status: {{ git_status }}</p>
|
||||
<p>Website status: {{ website_status }}</p>
|
||||
{% endblock %}
|
Loading…
Reference in a new issue