Implementing today's weather forecast

It's time to start adding the implementation of the _today_forecast method, but first, we need to import BeautifulSoup. At the top of the file, add the following import statement:

from bs4 import BeautifulSoup

Now, we can start adding the _today_forecast method:

def _today_forecast(self, args):    criteria = {        'today_nowcard-temp': 'div',        'today_nowcard-phrase': 'div',        'today_nowcard-hilo': 'div',        }    content = self._request.fetch_data(args.forecast_option.value,                                       args.area_code)    bs = BeautifulSoup(content, 'html.parser')    container = bs.find('section', class_='today_nowcard-container')    weather_conditions = self._parse(container, criteria)    if len(weather_conditions) < 1: raise Exception('Could not parse weather ...

Get Python Programming Blueprints now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.