From 6e3a5f4db540acf3fe279c751f48f2730a1ae562 Mon Sep 17 00:00:00 2001 From: Justin Date: Tue, 23 May 2023 16:39:29 +0800 Subject: [PATCH] disable weather api keys --- server.py | 43 +++++++++++++++++++++---------------------- 1 file changed, 21 insertions(+), 22 deletions(-) diff --git a/server.py b/server.py index 0f8c1d3..60187c9 100755 --- a/server.py +++ b/server.py @@ -146,8 +146,8 @@ def index(): not_displaying = [f for f in all_features if f not in currently_displaying[0]] not_displaying2 = [f for f in all_features if f not in currently_displaying[1]] - with open('api_keys.txt', 'r') as f: - api_key2 = f.readlines() +# with open('api_keys.txt', 'r') as f: +# api_key2 = f.readlines() try: with open('movie_api_key.txt', 'r') as f: @@ -248,10 +248,10 @@ def index(): except: scheduler_settings = {"shutdown": {"hour": "00", "minute": "00", "enabled": False}, "reboot":{"hour": "00", "minute": "00", "enabled": False}, "timezone": "GMT", "brightness1":{"hour": "00", "minute": "00", "bright": "10", "enabled": False}, "brightness2":{"hour": "00", "minute": "00", "bright": "10", "enabled": False}, "brightness3":{"hour": "00", "minute": "00", "bright": "10", "enabled": False}, "brightness4":{"hour": "00", "minute": "00", "bright": "10", "enabled": False}} - try: # incase this doesnt exist - api_keys = api_key2[1] - except: - api_keys = '' +# try: # incase this doesnt exist +# api_keys = api_key2[1] +# except: +# api_keys = '' try: movie_api_key = movie_api[0] @@ -299,7 +299,6 @@ def index(): 'message_settings':message_settings, 'professional':professional, 'general_settings':general_settings, - 'api_keys':api_keys, 'movie_api_key':movie_api_key, 'ipo_api_key':ipo_api_key, 'wifi_SSID':wifi_SSID, @@ -755,25 +754,25 @@ def hostname(): return index() -@app.route("/saveWeatherAPIKey", methods = ['PUT', 'POST']) -def saveWeatherAPIKey(): +# @app.route("/saveWeatherAPIKey", methods = ['PUT', 'POST']) +# def saveWeatherAPIKey(): - data= request.data.decode('utf-8') - settings = json.loads(data) +# data= request.data.decode('utf-8') +# settings = json.loads(data) - key = settings['api_key'] +# key = settings['api_key'] - with open('./api_keys.txt') as f: - lines = f.readlines() - if len(lines) == 1: - lines.append(str(key)) - elif len(lines) == 2: - lines[1] = str(key) +# with open('./api_keys.txt') as f: +# lines = f.readlines() +# if len(lines) == 1: +# lines.append(str(key)) +# elif len(lines) == 2: +# lines[1] = str(key) - with open('./api_keys.txt', 'w') as f: - for line in lines: - f.write(line) - return index() +# with open('./api_keys.txt', 'w') as f: +# for line in lines: +# f.write(line) +# return index()