bug fixes
This commit is contained in:
@@ -422,8 +422,20 @@ def updateLeagueTables(api_key, league_ids):
|
||||
r = requests.get(url)
|
||||
try:
|
||||
all_data = r.json()
|
||||
except: # there is no data available
|
||||
except Exception as e: # there is no data available
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
fname = os.path.split(exc_tb.tb_frame.f_code.co_filename)[1]
|
||||
logf.write(str(e))
|
||||
logf.write('. file: ' + fname)
|
||||
logf.write('. line: ' + str(exc_tb.tb_lineno))
|
||||
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])))
|
||||
logf.write(url)
|
||||
continue
|
||||
|
||||
|
||||
|
||||
|
||||
teams = []
|
||||
|
||||
|
||||
@@ -479,8 +491,17 @@ def updateLeagueEvents(api_key, league_ids, time):
|
||||
r = requests.get(url)
|
||||
try:
|
||||
all_data = r.json()
|
||||
except: # there is no data available
|
||||
except Exception as e: # there is no data available
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
fname = os.path.split(exc_tb.tb_frame.f_code.co_filename)[1]
|
||||
logf.write(str(e))
|
||||
logf.write('. file: ' + fname)
|
||||
logf.write('. line: ' + str(exc_tb.tb_lineno))
|
||||
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])))
|
||||
logf.write(url)
|
||||
continue
|
||||
|
||||
|
||||
|
||||
events = []
|
||||
@@ -634,7 +655,7 @@ if __name__ == '__main__':
|
||||
#stocks
|
||||
stock_time = datetime.strptime(last_updates['stocks'], "%d/%m/%Y %H:%M:%S")
|
||||
stock_frequency = update_frequencies['stocks']
|
||||
if checkStocks(stock_time, stock_frequency):
|
||||
if checkStocks(stock_time, stock_frequency) or msg == 's':
|
||||
stock_time = NY_time.strftime("%d/%m/%Y %H:%M:%S")
|
||||
last_updates['stocks'] = stock_time
|
||||
|
||||
@@ -644,7 +665,7 @@ if __name__ == '__main__':
|
||||
|
||||
NY_time = datetime.now(NY_zone).replace(tzinfo=None)
|
||||
diff = (NY_time - crypto_time).total_seconds()/60 #minutes
|
||||
if diff >= update_frequencies['crypto']:
|
||||
if diff >= update_frequencies['crypto'] or msg == 'c':
|
||||
crypto_time = NY_time.strftime("%d/%m/%Y %H:%M:%S")
|
||||
updateCrypto()
|
||||
last_updates['crypto'] = crypto_time
|
||||
@@ -656,7 +677,7 @@ if __name__ == '__main__':
|
||||
|
||||
NY_time = datetime.now(NY_zone).replace(tzinfo=None)
|
||||
diff = (NY_time - weather_time).total_seconds()/60 #minutes
|
||||
if diff >= update_frequencies['weather']:
|
||||
if diff >= update_frequencies['weather'] or msg == 'w':
|
||||
weather_time = NY_time.strftime("%d/%m/%Y %H:%M:%S")
|
||||
updateWeather()
|
||||
last_updates['weather'] = weather_time
|
||||
@@ -668,7 +689,7 @@ if __name__ == '__main__':
|
||||
|
||||
NY_time = datetime.now(NY_zone).replace(tzinfo=None)
|
||||
diff = (NY_time - news_time).total_seconds()/60 #minutes
|
||||
if diff >= update_frequencies['news']:
|
||||
if diff >= update_frequencies['news'] or msg == 'n':
|
||||
news_time = NY_time.strftime("%d/%m/%Y %H:%M:%S")
|
||||
updateNews()
|
||||
last_updates['news'] = news_time
|
||||
@@ -679,7 +700,7 @@ if __name__ == '__main__':
|
||||
|
||||
NY_time = datetime.now(NY_zone).replace(tzinfo=None)
|
||||
diff = (NY_time - sports_time).total_seconds()/60 #minutes
|
||||
if diff >= update_frequencies['sports']:
|
||||
if diff >= update_frequencies['sports'] or msg == 'S':
|
||||
sports_time = NY_time.strftime("%d/%m/%Y %H:%M:%S")
|
||||
updateSports()
|
||||
last_updates['sports'] = sports_time
|
||||
@@ -691,7 +712,7 @@ if __name__ == '__main__':
|
||||
CET_time = datetime.now(CET_zone)
|
||||
yday_update = (CET_time.replace(hour=17, minute=00, second=0, microsecond=0) - dt.timedelta(days=1)).replace(tzinfo=None)
|
||||
|
||||
if forex_time < yday_update:
|
||||
if forex_time < yday_update or msg == 'f':
|
||||
forex_time = CET_time.strftime("%d/%m/%Y %H:%M:%S")
|
||||
last_updates['forex'] = forex_time
|
||||
updateForex()
|
||||
|
Reference in New Issue
Block a user