disable weather api keys

This commit is contained in:
Justin
2023-05-23 16:39:29 +08:00
committed by GitHub
parent 508456ff19
commit 6e3a5f4db5

View File

@@ -146,8 +146,8 @@ def index():
not_displaying = [f for f in all_features if f not in currently_displaying[0]] 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]] not_displaying2 = [f for f in all_features if f not in currently_displaying[1]]
with open('api_keys.txt', 'r') as f: # with open('api_keys.txt', 'r') as f:
api_key2 = f.readlines() # api_key2 = f.readlines()
try: try:
with open('movie_api_key.txt', 'r') as f: with open('movie_api_key.txt', 'r') as f:
@@ -248,10 +248,10 @@ def index():
except: 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}} 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 # try: # incase this doesnt exist
api_keys = api_key2[1] # api_keys = api_key2[1]
except: # except:
api_keys = '' # api_keys = ''
try: try:
movie_api_key = movie_api[0] movie_api_key = movie_api[0]
@@ -299,7 +299,6 @@ def index():
'message_settings':message_settings, 'message_settings':message_settings,
'professional':professional, 'professional':professional,
'general_settings':general_settings, 'general_settings':general_settings,
'api_keys':api_keys,
'movie_api_key':movie_api_key, 'movie_api_key':movie_api_key,
'ipo_api_key':ipo_api_key, 'ipo_api_key':ipo_api_key,
'wifi_SSID':wifi_SSID, 'wifi_SSID':wifi_SSID,
@@ -755,25 +754,25 @@ def hostname():
return index() return index()
@app.route("/saveWeatherAPIKey", methods = ['PUT', 'POST']) # @app.route("/saveWeatherAPIKey", methods = ['PUT', 'POST'])
def saveWeatherAPIKey(): # def saveWeatherAPIKey():
data= request.data.decode('utf-8') # data= request.data.decode('utf-8')
settings = json.loads(data) # settings = json.loads(data)
key = settings['api_key'] # key = settings['api_key']
with open('./api_keys.txt') as f: # with open('./api_keys.txt') as f:
lines = f.readlines() # lines = f.readlines()
if len(lines) == 1: # if len(lines) == 1:
lines.append(str(key)) # lines.append(str(key))
elif len(lines) == 2: # elif len(lines) == 2:
lines[1] = str(key) # lines[1] = str(key)
with open('./api_keys.txt', 'w') as f: # with open('./api_keys.txt', 'w') as f:
for line in lines: # for line in lines:
f.write(line) # f.write(line)
return index() # return index()