from flask import Blueprint, render_template
from gateways.models import getWeatherData


web = Blueprint("web", __name__, template_folder='templates')

@web.route("/", methods=['GET'])
def home():
    items = getWeatherData.get_last_item()
    cityName = items["city"]
    return render_template("index.html",
                            city=cityName[0],
                            temperature=items["temperature"],
                            humidity=items["humidity"],
                            pressure=items["pressure"])

#@web.route("/profile", methods=['GET'])
#def profile():
#    items = getWeatherData.get_last_item()
#    return render_template("profile.html",
#                            celcius=items["temperature"],
#                            humidity=items["humidity"],
#                            pressure=items["pressure"])


#@web.route("/about", methods=['GET'])
#def about():
#    return render_template("about.html")

[((96, 151), 'flask.Blueprint', 'Blueprint', (['"""web"""', '__name__'], {'template_folder': '"""templates"""'}), "('web', __name__, template_folder='templates')\n", (105, 151), False, 'from flask import Blueprint, render_template\n'), ((210, 240), 'gateways.models.getWeatherData.get_last_item', 'getWeatherData.get_last_item', ([], {}), '()\n', (238, 240), False, 'from gateways.models import getWeatherData\n'), ((281, 423), 'flask.render_template', 'render_template', (['"""index.html"""'], {'city': 'cityName[0]', 'temperature': "items['temperature']", 'humidity': "items['humidity']", 'pressure': "items['pressure']"}), "('index.html', city=cityName[0], temperature=items[\n    'temperature'], humidity=items['humidity'], pressure=items['pressure'])\n", (296, 423), False, 'from flask import Blueprint, render_template\n')]