mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-12-02 16:09:24 +01:00
We should also be catching timeouts on the read.
This commit is contained in:
parent
a76036722e
commit
1300548d0a
@ -69,10 +69,13 @@ def getUrlFd(url):
|
|||||||
def getUrl(url, size=None):
|
def getUrl(url, size=None):
|
||||||
"""Gets a page. Returns a string that is the page gotten."""
|
"""Gets a page. Returns a string that is the page gotten."""
|
||||||
fd = getUrlFd(url)
|
fd = getUrlFd(url)
|
||||||
|
try:
|
||||||
if size is None:
|
if size is None:
|
||||||
text = fd.read()
|
text = fd.read()
|
||||||
else:
|
else:
|
||||||
text = fd.read(size)
|
text = fd.read(size)
|
||||||
|
except socket.timeout, e:
|
||||||
|
raise WebError, TIMED_OUT
|
||||||
fd.close()
|
fd.close()
|
||||||
return text
|
return text
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user