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 = 'Cloud Server

Global Lights

' for result in results: html += '' html += '' conn.close() return html # If we're running in stand alone mode, run the application if __name__ == '__main__': # app.run(host='0.0.0.0', port=5000, debug=True) app.run(host='0.0.0.0', port=5000)
IDDevice NameLightTimestamp
' + str(result[0]) + '' + str(result[1]) + '' + str(result[2]) + '' + str(result[3]) + '