import connexion import sqlite3 app = connexion.FlaskApp(__name__, specification_dir='./') app.add_api('cloud.yml') @app.route('/') def index(): conn = sqlite3.connect('light.db') c = conn.cursor() c.execute('SELECT id, devicename, light, timestamp FROM light ORDER BY id DESC') results = c.fetchall() html = '
| ID | Device Name | Light | Timestamp |
|---|---|---|---|
| ' + str(result[0]) + ' | ' + str(result[1]) + ' | ' + str(result[2]) + ' | ' + str(result[3]) + ' |