X-Git-Url: https://git.phdru.name/?a=blobdiff_plain;f=Robots%2Fbkmk_rurllib.py;h=6f15ad5cf193aecd5832dd5ed7837ca2f936e232;hb=97202bf84e9c78d8fac912a82a85fb1cbb233a4b;hp=9acbd883d8ef84ac4df1b03bba08f94a866486c0;hpb=e0fcc1ffc89baeb5ddba4250612c36850fd022c5;p=bookmarks_db.git diff --git a/Robots/bkmk_rurllib.py b/Robots/bkmk_rurllib.py index 9acbd88..6f15ad5 100644 --- a/Robots/bkmk_rurllib.py +++ b/Robots/bkmk_rurllib.py @@ -5,7 +5,7 @@ This file is a part of Bookmarks database and Internet robot. """ __author__ = "Oleg Broytman " -__copyright__ = "Copyright (C) 2000-2014 PhiloSoft Design" +__copyright__ = "Copyright (C) 2000-2017 PhiloSoft Design" __license__ = "GNU GPL" __all__ = ['robot_urllib'] @@ -42,13 +42,13 @@ class MyURLopener(urllib.URLopener): # Error 401 -- authentication required def http_error_401(self, url, fp, errcode, errmsg, headers, data=None): - raise IOError, ('http error', errcode, "Authentication required ", headers) + raise IOError(('http error', errcode, "Authentication required ", headers)) def http_error_default(self, url, fp, errcode, errmsg, headers): if fp: void = fp.read() fp.close() - raise IOError, ('http error', errcode, errmsg, headers) + raise IOError(('http error', errcode, errmsg, headers)) urllib._urlopener = MyURLopener() @@ -99,16 +99,16 @@ class robot_urllib(robot_base): return None, None, None, headers, content - except RedirectException, e: + except RedirectException as e: return None, e.errcode, e.newurl, None, None - except IOError, msg: - if (msg[0] == "http error") and (msg[1] == -1): + except IOError as e: + if (e[0] == "http error") and (e[1] == -1): error = None bookmark.no_error = "The server did not return any header - it is not an error, actually" self.log(' no headers: %s' % bookmark.no_error) else: - error = get_error(msg) + error = get_error(e) self.log(' Error: %s' % error) return error, None, None, None, None