"""
__author__ = "Oleg Broytman <phd@phdru.name>"
-__copyright__ = "Copyright (C) 2014 PhiloSoft Design"
+__copyright__ = "Copyright (C) 2014-2017 PhiloSoft Design"
__license__ = "GNU GPL"
__all__ = ['robot_urllib2']
try:
response = urllib2.urlopen(request)
- except urllib2.HTTPError, e:
+ except urllib2.HTTPError as e:
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:
+ except urllib2.URLError as e:
self.log(' URL Error: %s' % e.reason)
return "URL Error: %s" % e.reason, None, None, None, None
- except httplib.HTTPException, e:
+ except httplib.HTTPException as e:
error = get_error(e)
self.log(' HTTP Exception: %s' % error)
return "HTTP Exception: %s" % error, None, None, None, None
- except IOError, e:
+ except IOError as e:
error = get_error(e)
self.log(' I/O Error: %s' % error)
return "I/O Error: %s" % error, None, None, None, None