File name
Commit message
Commit date
import sched
from flask_restx import Resource, Api, Namespace, fields
from flask import request
from flask import Flask, render_template, request
import pandas as pd
Action = Namespace(
name="Action",
description="노드 분석을 위해 사용하는 api.",
)
# @sched.scheduler
# def weather_update
@Action.route('/forecast')
class forecast(Resource):
@Action.doc(responses={200: 'Success'})
@Action.doc(responses={500: 'Register Failed'})
def post(self):
if request.method == 'GET':
df = pd.read_csv("data/weather/weather_data_forecast.csv")
humidity = df['forecast'].value[6:] / 6
if humidity > 90:
return {
'report': "warn"
}, 200
elif humidity <= 90 and humidity > 80:
return {
'report': "caution"
}, 200
else:
return {
'report': "safe"
}, 200