disable weather api keys
This commit is contained in:
parent
508456ff19
commit
6e3a5f4db5
43
server.py
43
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()
|
||||
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user