From 816027920e0468b982f2e1e1a51279459df08ee1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Y=C3=BBki=20Vachot?= Date: Mon, 18 Oct 2021 08:43:41 +0200 Subject: [PATCH] Update --- app.py | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/app.py b/app.py index 0b18452..b9c7396 100644 --- a/app.py +++ b/app.py @@ -35,7 +35,7 @@ def searchCity(): # put application's code here else: search = request.args.get('search') - if METEOCONCEPT_TOKEN == -1: + if METEOCONCEPT_TOKEN is None: log('Env variable METEOCONCEPT_TOKEN not passed') return 'Env variable METEOCONCEPT_TOKEN not passed' else: @@ -53,7 +53,7 @@ def getCity(): # put application's code here else: insee = request.args.get('insee') - if METEOCONCEPT_TOKEN == -1: + if METEOCONCEPT_TOKEN is None: log('Env variable METEOCONCEPT_TOKEN not passed') return 'Env variable METEOCONCEPT_TOKEN not passed' else: @@ -71,7 +71,7 @@ def ephemeride(): # put application's code here else: insee = request.args.get('insee') - if METEOCONCEPT_TOKEN == -1: + if METEOCONCEPT_TOKEN is None: log('Env variable METEOCONCEPT_TOKEN not passed') return 'Env variable METEOCONCEPT_TOKEN not passed' else: @@ -82,7 +82,7 @@ def ephemeride(): # put application's code here # Information sur les alentours d'une ville @app.route('/around', methods=['POST', 'GET']) -def ephemeride(): # put application's code here +def around(): # put application's code here if request.method == 'POST': insee = request.form['insee'] radius = request.form['radius'] @@ -90,7 +90,7 @@ def ephemeride(): # put application's code here insee = request.args.get('insee') radius = request.args.get('radius') - if METEOCONCEPT_TOKEN == -1: + if METEOCONCEPT_TOKEN is None: log('Env variable METEOCONCEPT_TOKEN not passed') return 'Env variable METEOCONCEPT_TOKEN not passed' else: @@ -99,13 +99,9 @@ def ephemeride(): # put application's code here around = json.loads(f.read()) return json.dumps(around, indent=INDENT, sort_keys=True) - - - - if __name__ == '__main__': PORT = int(os.environ.get('PORT', 33507)) # On Linux or MAC 'export METEOCONCEPT_TOKEN=...' (check shell echo $METEOCONCEPT_TOKEN) # On Windows 'set METEOCONCEPT_TOKEN=...' (check on Powershell echo $Env:METEOCONCEPT_TOKEN) - METEOCONCEPT_TOKEN = int(os.environ.get('METEOCONCEPT_TOKEN', -1)) + METEOCONCEPT_TOKEN = os.environ.get('METEOCONCEPT_TOKEN', None) app.run(host='0.0.0.0', port=PORT, debug=True) \ No newline at end of file