Refactor code
This commit is contained in:
@ -65,8 +65,10 @@ class WeatherToFreemobile():
|
|||||||
#17649060-between-hours-of-12-midnight-and-7am-gmt-we-are-receiving
|
#17649060-between-hours-of-12-midnight-and-7am-gmt-we-are-receiving
|
||||||
#-the-wrong-data-for-most-locations
|
#-the-wrong-data-for-most-locations
|
||||||
if( abs(weather_date.date()-datetime.date.today())
|
if( abs(weather_date.date()-datetime.date.today())
|
||||||
< datetime.timedelta(days=number_of_days)
|
>= datetime.timedelta(days=number_of_days)
|
||||||
):
|
):
|
||||||
|
logging.info('Skipped {} (cf. API Bug)'.format(weather_date))
|
||||||
|
else:
|
||||||
temp = weather.get_temperature(unit='celsius')
|
temp = weather.get_temperature(unit='celsius')
|
||||||
return_message.append(
|
return_message.append(
|
||||||
'{} : {} (min {}ºC, max {}ºC, rain:{}mm)'.format(
|
'{} : {} (min {}ºC, max {}ºC, rain:{}mm)'.format(
|
||||||
@ -77,8 +79,6 @@ class WeatherToFreemobile():
|
|||||||
weather.get_rain().get('all',0)
|
weather.get_rain().get('all',0)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
else:
|
|
||||||
logging.info('Skipped {} (cf. API Bug)'.format(weather_date))
|
|
||||||
|
|
||||||
logging.info("Got the following weather: {}".format(return_message))
|
logging.info("Got the following weather: {}".format(return_message))
|
||||||
return "\n".join(return_message)
|
return "\n".join(return_message)
|
||||||
|
Reference in New Issue
Block a user