mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-19 08:59:27 +01:00
Fixed a NameError exception
This commit is contained in:
parent
1f0e646ff3
commit
f5784851f2
@ -47,6 +47,7 @@ REFUSED = 'Connection refused.'
|
|||||||
TIMED_OUT = 'Connection timed out.'
|
TIMED_OUT = 'Connection timed out.'
|
||||||
UNKNOWN_HOST = 'Unknown host.'
|
UNKNOWN_HOST = 'Unknown host.'
|
||||||
RESET_BY_PEER = 'Connection reset by peer.'
|
RESET_BY_PEER = 'Connection reset by peer.'
|
||||||
|
FORBIDDEN = 'Client forbidden from accessing URL.'
|
||||||
|
|
||||||
def strError(e):
|
def strError(e):
|
||||||
try:
|
try:
|
||||||
@ -61,6 +62,8 @@ def strError(e):
|
|||||||
return RESET_BY_PEER
|
return RESET_BY_PEER
|
||||||
elif n == 8:
|
elif n == 8:
|
||||||
return UNKNOWN_HOST
|
return UNKNOWN_HOST
|
||||||
|
elif n == 403:
|
||||||
|
return FORBIDDEN
|
||||||
else:
|
else:
|
||||||
return str(e)
|
return str(e)
|
||||||
|
|
||||||
@ -74,9 +77,9 @@ def getUrlFd(url):
|
|||||||
except socket.error, e:
|
except socket.error, e:
|
||||||
raise WebError, strError(e)
|
raise WebError, strError(e)
|
||||||
except urllib2.URLError, e:
|
except urllib2.URLError, e:
|
||||||
raise WebError, strError(e.reason)
|
raise WebError, strError(e)
|
||||||
except urllib2.HTTPError, e:
|
except urllib2.HTTPError, e:
|
||||||
raise WebError, str(e)
|
raise WebError, strError(e)
|
||||||
|
|
||||||
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."""
|
||||||
|
Loading…
Reference in New Issue
Block a user