diff --git a/weather_openweathermap.py b/weather_openweathermap.py index a4bcf9e..702281d 100644 --- a/weather_openweathermap.py +++ b/weather_openweathermap.py @@ -31,7 +31,7 @@ class HourlyWeather: self.wind_speed = json_data['wind_speed'] self.probability_of_precipitation = json_data['pop'] if 'rain' in json_data: - self.rain = json_data['rain'] + self.rain = json_data['rain']['1h'] else: self.rain = 0 self.main = json_data['weather'][0]['main'] @@ -131,7 +131,7 @@ class City: self.lat = lat self.lon = lon - def get_weather(self): + def query_weather(self): request = requests.get( "http://api.openweathermap.org/data/2.5/onecall?\ lang=de&units=metric&exclude=minutely&lat={lat}&lon={lon}&appid={token}".format( @@ -193,7 +193,7 @@ def handle_weather(update, context): requested_city = get_city_by_name(' '.join(context.args)) if requested_city.name == "none": raise WeatherStationNotFoundError - requested_city.get_weather() + requested_city.query_weather() update.message.reply_text(str(requested_city.weather), disable_notification=True, parse_mode="Markdown") requested_city.weather.clear()