26 lines
670 B
Python
26 lines
670 B
Python
from flask import Flask, render_template_string
|
|
from cloudflare import get_dns_records
|
|
|
|
app = Flask(__name__)
|
|
|
|
# ----------------------------
|
|
# Template HTML già esistente
|
|
# ----------------------------
|
|
TEMPLATE = open("template.html").read() # Se preferisci usare file separato
|
|
|
|
# ----------------------------
|
|
# Endpoint principale
|
|
# ----------------------------
|
|
@app.route("/")
|
|
def index():
|
|
records = get_dns_records()
|
|
|
|
# Passiamo i dati al template
|
|
return render_template_string(TEMPLATE, records=records)
|
|
|
|
# ----------------------------
|
|
# Avvio Flask
|
|
# ----------------------------
|
|
if __name__ == "__main__":
|
|
app.run(host="0.0.0.0", port=5000)
|