WatchWebsite module: Avoid timeout when watching a website

This commit is contained in:
Némunaire 2012-12-07 11:06:43 +01:00
parent d08273e832
commit 022879a4bf

View File

@ -38,7 +38,10 @@ def unload(context):
def getPageContent(url):
"""Returns the content of the given url"""
print_debug("Get page %s" % url)
raw = urlopen(url, timeout=15)
try:
raw = urlopen(url, timeout=15)
except socket.timeout:
return None
return raw.read().decode()
def start_watching(site):