Update
This commit is contained in:
parent
b45e5dd740
commit
4d6e8c931c
2 changed files with 19 additions and 0 deletions
18
app.py
18
app.py
|
|
@ -80,6 +80,24 @@ def ephemeride(): # put application's code here
|
|||
cityEph = json.loads(f.read())
|
||||
return json.dumps(cityEph, indent=INDENT, sort_keys=True)
|
||||
|
||||
# TODO Information sur la ville et Ephéméride
|
||||
@app.route('/around', methods=['POST', 'GET'])
|
||||
def ephemeride(): # put application's code here
|
||||
if request.method == 'POST':
|
||||
insee = request.form['insee']
|
||||
radius = request.form['radius']
|
||||
else:
|
||||
insee = request.args.get('insee')
|
||||
radius = request.args.get('radius')
|
||||
|
||||
if METEOCONCEPT_TOKEN == -1:
|
||||
log('Env variable METEOCONCEPT_TOKEN not passed')
|
||||
return 'Env variable METEOCONCEPT_TOKEN not passed'
|
||||
else:
|
||||
log('Env variable METEOCONCEPT_TOKEN passed')
|
||||
with closing(urlopen(API_OBSERVATIONS_AROUND + API_TOKEN + METEOCONCEPT_TOKEN + API_INSEE + insee + API_RADIUS + radius)) as f:
|
||||
around = json.loads(f.read())
|
||||
return json.dumps(around, indent=INDENT, sort_keys=True)
|
||||
|
||||
|
||||
# TODO Information sur les alentours d'une ville
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ BASE_API_URL = 'https://api.meteo-concept.com/api/'
|
|||
API_TOKEN = '?token='
|
||||
API_SEARCH = '&search='
|
||||
API_INSEE = '&insee='
|
||||
API_RADIUS = '&radius='
|
||||
|
||||
API_LOCATION_CITIES = BASE_API_URL + 'location/cities'
|
||||
API_LOCATION_CITY = BASE_API_URL + 'location/city'
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue