28 lines
617 B
Python
28 lines
617 B
Python
from flask import Flask, render_template, request, redirect, session
|
|
import time
|
|
|
|
app = Flask(__name__);
|
|
|
|
last_value: str
|
|
|
|
try:
|
|
with open("bozo", 'r') as f:
|
|
last_value: str = f.read()
|
|
except:
|
|
with open("bozo", 'w+') as f:
|
|
last_value = str(time.time() * 1000)
|
|
f.write(last_value)
|
|
|
|
@app.route("/api/update", methods = ['GET'])
|
|
def get():
|
|
return str(last_value)
|
|
|
|
@app.route("/api/update", methods = ['POST'])
|
|
def update():
|
|
last_value = str(time.time() * 1000)
|
|
f.write(last_value)
|
|
return
|
|
|
|
if __name__ == '__main__':
|
|
app.run(host='0.0.0.0', port=5000, debug=1)
|