Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def weather(bot, update, args):
- """Define weather at a location"""
- owm = pyowm.OWM('3b5c55ddba3216f2bef84a635f214a0a')
- text_location = "".join(str(x) for x in args)
- observation = owm.weather_at_place(text_location)
- w = observation.get_weather()
- humidity = w.get_humidity()
- wind = w.get_wind()
- temp = w.get_temperature('celsius')
- convert_temp = temp.get('temp')
- convert_wind = wind.get('speed')
- convert_humidity = humidity
- text_temp = str(convert_temp)
- text_wind = str(convert_wind)
- text_humidity = str(convert_humidity)
- update.message.reply_text("Temperature, celsius:")
- update.message.reply_text(text_temp)
- update.message.reply_text("Wind speed, m/s:")
- update.message.reply_text(text_wind)
- update.message.reply_text("Humidity, %:")
- update.message.reply_text(text_humidity)
Advertisement
Add Comment
Please, Sign In to add comment