Update for Datalore Partie 4

This commit is contained in:
Yûki VACHOT 2021-11-28 20:55:26 +01:00
parent ef26c987a2
commit 08b3ea531c
63 changed files with 12913 additions and 68 deletions

View file

@ -1,4 +1,4 @@
from flask import Flask, request
from flask import Flask, request, render_template
from api_fonction import *
app = Flask(__name__)
@ -42,6 +42,15 @@ def current(): # put application's code here
query = request.args.get('query')
return app_response(getCurrent(query, app.config['METEOCONCEPT_TOKEN'], app.config['WEATHERSTACK_TOKEN']))
# Prévision pour une ville
@app.route('/forecast', methods=['POST', 'GET'])
def forecast(): # put application's code here
if request.method == 'POST':
query = request.form['query']
else:
query = request.args.get('query')
return app_response(getForecast(query, app.config['METEOCONCEPT_TOKEN'], app.config['WEATHERSTACK_TOKEN']))
# Informations sur la Ville
@app.route('/city', methods=['POST', 'GET'])
@ -53,28 +62,6 @@ def city(): # put application's code here
return app_response(getCity(query, app.config['METEOCONCEPT_TOKEN'], app.config['WEATHERSTACK_TOKEN']))
# @app.route('/', methods=['POST', 'GET'])
# def index():
# response_cities = False
# response_ephemeride = False
# response_around = False
#
# search = Search()
# city = City()
# around = Around()
#
# if search.submit_search.data and search.validate_on_submit():
# return render_template('index.html', cities=getApiCity(search))
#
# if city.submit_city.data and city.validate_on_submit():
# return render_template('index.html', ephemeride=getEphemeride(city))
#
# if around.submit_around.data and around.validate_on_submit():
# return render_template('index.html', around=getAround(around, 1))
#
# # TODO Multiple form for insee ? or ajax ?
# insee = request.form['insee']
# response_ephemeride = getEphemeride(insee)
# response_around = getAround(insee, 1)
#
# return render_template('index.html', cities=response_cities, ephemeride=response_ephemeride, around=response_around)
@app.route('/', methods=['POST', 'GET'])
def index():
return render_template('index.html')