Teacher's Choice

Pulling Weather Data (Teacher's Choice)

  1. Identify some other Web sites where information in the URL is used in processing. For each site, describe how the information is used.

Many websites provide current weather and forecasting. Some websites, such as Weatherstreet, can give specific information about a location through the use of URL tags. Weatherstreet can accept locations and ZIP codes, like this:

In this lab, you will pull two pieces of information—the temperature and weather conditions—from these pages to build a simple weather app. For New York, the page above shows that the current temperature was 34 degrees, and the current condition was Haze.

  1. Use the "View Source" command in your Web browser to look at the HTML generated by the Weatherstreet page. Where in the HTML is the current temperature shown? How could you most easily locate this specific line?
  2. Note that there is no space between the city and state: Boston,MA. For cities with multiple words, add a plus: New+York,NY. These requirements are particular to this website, not general to the entire Web.
  3. Use the scraping techniques from Lab 1 to design a Current Temperature In block block. The input is a ZIP code or a city and state, and the output is the current temperature in degrees Fahrenheit.
  4. 34 degrees in New York
  5. Build a similar block to give the current weather conditions for the location you specified.
  6. "U4L5-WeatherInfo"save your work as U4L5-WeatherInfo