Skip a server when it cannot be reached

develop
Sven Slootweg 12 years ago
parent 51916b8bbd
commit 0a2d4fcb9f

@ -98,7 +98,12 @@ class CalibreCrawler(threading.Thread):
print "[calibr] Starting crawl on %s ..." % url print "[calibr] Starting crawl on %s ..." % url
response = urllib2.urlopen(url + "browse/category/allbooks") try:
response = urllib2.urlopen(url + "browse/category/allbooks")
except URLError:
print "Skipping %s, as the server could not be successfully reached." % url
return None
page_contents = response.read() page_contents = response.read()
matcher = re.compile("<div class=\"load_data\" title=\"([\[\]0-9\s,]*)\">") matcher = re.compile("<div class=\"load_data\" title=\"([\[\]0-9\s,]*)\">")

Loading…
Cancel
Save