Since the book is written in 2011, parts of Python codes in the book are no longer working in my environment (Python 3.4.0 with BeautifulSoup 4.3.2). I had to go line by line and do a log of googling to figure out what has been changed and what to do for those changes. This is for my future reference, and hopefully others can find this helpful when they study with this book.
import urllib2 urllib.request
from BeautifulSoup bs4 import BeautifulSoup
print "Getting data for" + timestamp ("Getting data for " + timestamp)
page = urllib2.urlopen(url) urllib.request.urlopen(url)
dayTemp = soup.findAll(attrs={"class":"nobr wx-value"})[5 1].span.string
It works like a charm!