Guest User

Untitled

a guest
Aug 20th, 2018
247
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. def weather(bot, update, args):
  2. """Define weather at a location"""
  3. owm = pyowm.OWM('3b5c55ddba3216f2bef84a635f214a0a')
  4. text_location = "".join(str(x) for x in args)
  5. observation = owm.weather_at_place(text_location)
  6. w = observation.get_weather()
  7. humidity = w.get_humidity()
  8. wind = w.get_wind()
  9. temp = w.get_temperature('celsius')
  10. convert_temp = temp.get('temp')
  11. convert_wind = wind.get('speed')
  12. convert_humidity = humidity
  13. text_temp = str(convert_temp)
  14. text_wind = str(convert_wind)
  15. text_humidity = str(convert_humidity)
  16. update.message.reply_text("Temperature, celsius:")
  17. update.message.reply_text(text_temp)
  18. update.message.reply_text("Wind speed, m/s:")
  19. update.message.reply_text(text_wind)
  20. update.message.reply_text("Humidity, %:")
  21. update.message.reply_text(text_humidity)
Advertisement
Add Comment
Please, Sign In to add comment