revert weather
This commit is contained in:
parent
2309233ebe
commit
9803a9ac41
@ -283,15 +283,14 @@ def updateWeather(api_key, logf):
|
||||
current_locations = list(all_current_settings['locations'].keys())
|
||||
daily_locations = list(all_daily_settings['locations'].keys())
|
||||
|
||||
print(current_locations, daily_locations)
|
||||
all_locations = list(set(current_locations + daily_locations))
|
||||
print(all_locations)
|
||||
|
||||
|
||||
|
||||
|
||||
currents = []
|
||||
dailys = []
|
||||
current_weathers = {}
|
||||
daily_weathers = {}
|
||||
|
||||
|
||||
|
||||
for location in all_locations:
|
||||
@ -320,7 +319,8 @@ def updateWeather(api_key, logf):
|
||||
current_weather['rain_chance'] = r.json()['hourly'][0]['pop']
|
||||
|
||||
|
||||
currents.append(current_weather)
|
||||
if location in current_locations:
|
||||
current_weathers[location] = current_weather
|
||||
|
||||
daily_weather = []
|
||||
daily = r.json()['daily']
|
||||
@ -344,24 +344,8 @@ def updateWeather(api_key, logf):
|
||||
daily_weather[0]['wind_direction'] = current_weather['wind_direction']
|
||||
daily_weather[0]['visibility'] = current_weather['visibility']
|
||||
|
||||
dailys.append(daily_weather)
|
||||
|
||||
current_weathers = {}
|
||||
daily_weathers = {}
|
||||
|
||||
|
||||
|
||||
for l in current_locations:
|
||||
for i,loc in enumerate(all_locations):
|
||||
if l == loc:
|
||||
current_weathers[location] = currents[i]
|
||||
|
||||
for l in daily_locations:
|
||||
for i,loc in enumerate(all_locations):
|
||||
if l == loc:
|
||||
daily_weathers[location] = dailys[i]
|
||||
|
||||
|
||||
if location in daily_locations:
|
||||
daily_weathers[location] = daily_weather
|
||||
|
||||
|
||||
|
||||
@ -381,7 +365,6 @@ def updateWeather(api_key, logf):
|
||||
logf.write('. type: ' + str(exc_type))
|
||||
logf.write('\n ' + "".join(traceback.format_exception(sys.exc_info()[0], sys.exc_info()[1], sys.exc_info()[2])))
|
||||
|
||||
|
||||
def updateLeagueTables(api_key, logf):
|
||||
print('LEAGUE TABLES')
|
||||
url = 'https://bm7p954xoh.execute-api.us-east-2.amazonaws.com/default/ScriptsAPI/sports?stats='
|
||||
|
Loading…
Reference in New Issue
Block a user