We should also be catching timeouts on the read.

This commit is contained in:
James Vega 2004-02-20 22:46:10 +00:00
parent a76036722e
commit 1300548d0a

View File

@ -69,10 +69,13 @@ def getUrlFd(url):
def getUrl(url, size=None):
"""Gets a page. Returns a string that is the page gotten."""
fd = getUrlFd(url)
if size is None:
text = fd.read()
else:
text = fd.read(size)
try:
if size is None:
text = fd.read()
else:
text = fd.read(size)
except socket.timeout, e:
raise WebError, TIMED_OUT
fd.close()
return text