Files
flask-weather/weather/api.py

19 lines
401 B
Python

from flask import (
Blueprint
)
from werkzeug.exceptions import abort
from weather.db import get_db
bp = Blueprint('api', __name__)
@bp.route('/api')
def api():
db = get_db()
current_conditions = dict(db.execute(
"SELECT * FROM `current_forecasts` WHERE DATETIME('now', 'localtime') BETWEEN `start_time` AND `end_time` LIMIT 1"
).fetchone())
return current_conditions