|
@@ -6,6 +6,8 @@ import linebot.models as linebotModels
|
|
|
import suggests
|
|
|
from GoogleNews import GoogleNews
|
|
|
import dataset
|
|
|
+import datetime
|
|
|
+from fastapi.responses import HTMLResponse
|
|
|
#
|
|
|
|
|
|
from linebot.models import (
|
|
@@ -70,13 +72,14 @@ def get_aws():
|
|
|
|
|
|
@app.get("/aws")
|
|
|
async def aws():
|
|
|
- result='<html><body><table>'
|
|
|
+ result='<html><body>'
|
|
|
+ result+='製表時間: '+str(datetime.datetime.now())+'</br>\n<table>'
|
|
|
db = dataset.connect('mysql://choozmo:pAssw0rd@db.ptt.cx:3306/hhh?charset=utf8mb4')
|
|
|
cursor=db.query('SELECT from_unixtime(eventtime) as dt,area FROM hhh.aws_monitor order by eventtime desc limit 10;')
|
|
|
for c in cursor:
|
|
|
result+="<tr><td>"+str(c['dt'])+"</td><td>"+c['area']+"</td></tr>\n"
|
|
|
result+='</table></body></html>'
|
|
|
- return result
|
|
|
+ return HTMLResponse(content=result, status_code=200)
|
|
|
|
|
|
@app.get("/msg/{item_id}")
|
|
|
async def coffee_msg(item_id):
|