import sys
import httplib
import urllib2
-from Robots.bkmk_robot_base import robot_base
+from Robots.bkmk_robot_base import robot_base, get_error
opener = urllib2.OpenerDirector()
if e.code in (301, 302, 303, 307):
return None, e.code, e.hdrs['Location'], None, None
else:
+ self.log(' HTTP Error %s: %s' % (e.code, e.msg))
return "HTTP Error %s: %s" % (e.code, e.msg), None, None, None, None
except urllib2.URLError, e:
+ self.log(' URL Error: %s' % e.reason)
return "URL Error: %s" % e.reason, None, None, None, None
+ except httplib.HTTPException, e:
+ error = get_error(e)
+ self.log(' HTTP Exception: %s' % error)
+ return "HTTP Exception: %s" % error, None, None, None, None
+ except IOError, e:
+ error = get_error(e)
+ self.log(' I/O Error: %s' % error)
+ return "I/O Error: %s" % error, None, None, None, None
else:
return None, None, None, response.info(), response.read()