Added urllib2 import so that exception could be caught.