try and except create json files if missing
This commit is contained in:
parent
f7f8fff458
commit
b9007f6d5f
15
server.py
15
server.py
@ -270,7 +270,8 @@ def index():
|
||||
f.close()
|
||||
except:
|
||||
ipo_settings = {"feature": "IPO", "speed": "medium", "speed2": "medium", "animation": "down", "title": True, "symbols": ["No Data"]}
|
||||
|
||||
with open('csv/ipo_settings.json', 'w') as f:
|
||||
json.dump(ipo_settings, f)
|
||||
try:
|
||||
f = open('csv/forex_settings.json', 'r')
|
||||
forex_settings = json.load(f)
|
||||
@ -358,7 +359,8 @@ def index():
|
||||
f.close()
|
||||
except:
|
||||
economic_settings = {"feature": "Economic Calendar", "speed": "medium", "speed2": "medium", "animation": "up", "importance": "Med - High", "title": True, "timezone": "US/Eastern", "countries": ["United States"], "events": []}
|
||||
|
||||
with open('csv/economic_settings.json', 'w') as f:
|
||||
json.dump(economic_settings, f)
|
||||
try:
|
||||
f = open('csv/jokes_settings.json', 'r')
|
||||
jokes_settings = json.load(f)
|
||||
@ -367,7 +369,8 @@ def index():
|
||||
jokes_settings['categories'] = ['Any']
|
||||
except:
|
||||
jokes_settings = {"feature": "Jokes", "speed": "medium", "speed2": "medium", "animation": "up", "title": True, "safe": True, "categories": ["Any"], "blacklist": [], "amount": "5", "jokes": []}
|
||||
|
||||
with open('csv/jokes_settings.json', 'w') as f:
|
||||
json.dump(jokes_settings, f)
|
||||
try:
|
||||
f = open('csv/place_settings.json', 'r')
|
||||
place_settings = json.load(f)
|
||||
@ -382,14 +385,16 @@ def index():
|
||||
f.close()
|
||||
except:
|
||||
market_settings = {"feature": "Gainers, Losers, Active", "speed": "medium", "speed2": "medium", "animation": "up", "percent": True, "point": True, "logos": True, "chart": False, "title": True, "lohivol": False, "categories": ["Top Gainers", "Top Losers", "Most Active"], "gainers": {}, "losers": {}, "mostactive": {}}
|
||||
|
||||
with open('csv/market_settings.json', 'w') as f:
|
||||
json.dump(market_settings, f)
|
||||
try:
|
||||
f = open('csv/sector_settings.json', 'r')
|
||||
sector_settings = json.load(f)
|
||||
f.close()
|
||||
except:
|
||||
sector_settings = {"feature": "Sector Performance", "speed": "medium", "speed2": "medium", "animation": "up", "logos": True, "title": True, "sectors": ["Energy", "Financials", "Real Estate", "Technology"], "data": {}}
|
||||
|
||||
with open('csv/sector_settings.json', 'w') as f:
|
||||
json.dump(sector_settings, f)
|
||||
try:
|
||||
f = open('csv/scheduler.json','r')
|
||||
scheduler_settings = json.load(f)
|
||||
|
Loading…
Reference in New Issue
Block a user