Use urllib2 instead of urllib. Define a timeout for urlopen