HTML weather dashboard

Now it's time to add what we learned from the previous chapters. Let's revisit the CurrentWeather class from Chapter 4, Subscribing to Web Services. We will rename it WeatherData, as this name is more appropriate for this project, and change it a little bit.

  1. Open up Thonny from Application Menu | Programming | Thonny Python IDE
  2. Click on the New icon to create a new file
  1. Type the following:
from weather import Weather, Unitimport timeclass WeatherData:        temperature = 0    weather_conditions = ''    wind_speed = 0    city = ''              def __init__(self, city):        self.city = city        weather = Weather(unit = Unit.CELSIUS)        lookup = weather.lookup_by_location(self.city)        self.temperature = lookup.condition.temp self.weather_conditions = lookup.condition.text ...

Get Internet of Things Programming Projects now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.