Fix for weather-location by id
This commit is contained in:
parent
418422fa52
commit
159c2d2642
@ -112,14 +112,11 @@ class Weather(inkycal_module):
|
|||||||
fonts['weathericons-regular-webfont'], size = self.fontsize)
|
fonts['weathericons-regular-webfont'], size = self.fontsize)
|
||||||
|
|
||||||
# give an OK message
|
# give an OK message
|
||||||
print('{0} loaded'.format(filename))
|
print(f"{filename} loaded")
|
||||||
|
|
||||||
|
|
||||||
def _validate(self):
|
def _validate(self):
|
||||||
|
|
||||||
if not isinstance(self.location, str):
|
|
||||||
print(f'location should be -> Manchester, USA, not {self.location}')
|
|
||||||
|
|
||||||
if not isinstance(self.api_key, str):
|
if not isinstance(self.api_key, str):
|
||||||
print(f'api_key should be a string, not {self.api_key}')
|
print(f'api_key should be a string, not {self.api_key}')
|
||||||
|
|
||||||
@ -320,9 +317,8 @@ class Weather(inkycal_module):
|
|||||||
|
|
||||||
# Create current-weather and weather-forecast objects
|
# Create current-weather and weather-forecast objects
|
||||||
if self.location.isdigit():
|
if self.location.isdigit():
|
||||||
self.location = int(self.location)
|
weather = self.owm.weather_at_id(int(self.location)).weather
|
||||||
weather = self.owm.weather_at_id(self.location).weather
|
forecast = self.owm.forecast_at_id(int(self.location), '3h')
|
||||||
forecast = self.owm.forecast_at_id(self.location, '3h')
|
|
||||||
else:
|
else:
|
||||||
weather = self.owm.weather_at_place(self.location).weather
|
weather = self.owm.weather_at_place(self.location).weather
|
||||||
forecast = self.owm.forecast_at_place(self.location, '3h')
|
forecast = self.owm.forecast_at_place(self.location, '3h')
|
||||||
|
Loading…
Reference in New Issue
Block a user