]> git.phdru.name Git - bookmarks_db.git/blobdiff - Robots/bkmk_rurllib.py
Style: Fix flake8 E302 expected 2 blank lines, found 1
[bookmarks_db.git] / Robots / bkmk_rurllib.py
index c7324e315bcd7ad5a5c1c1b785bcf2c139a29f91..3ef47eba975ac4d475306915ec862701d0f33c05 100644 (file)
@@ -5,7 +5,7 @@ This file is a part of Bookmarks database and Internet robot.
 """
 
 __author__ = "Oleg Broytman <phd@phdru.name>"
-__copyright__ = "Copyright (C) 2000-2017 PhiloSoft Design"
+__copyright__ = "Copyright (C) 2000-2023 PhiloSoft Design"
 __license__ = "GNU GPL"
 
 __all__ = ['robot_urllib']
@@ -22,6 +22,7 @@ class RedirectException(Exception):
         self.errcode = errcode
         self.newurl = newurl
 
+
 class MyURLopener(urllib.URLopener):
     # Error 301 -- relocated (permanently)
     def http_error_301(self, url, fp, errcode, errmsg, headers, data=None):
@@ -70,6 +71,7 @@ urllib._urlopener.addheader('Connection', 'close')
 urllib_ftpwrapper = urllib.ftpwrapper
 ftpcache_key = None
 
+
 class myftpwrapper(urllib_ftpwrapper):
     def __init__(self, user, passwd, host, port, dirs):
         urllib_ftpwrapper.__init__(self, user, passwd, host, port, dirs)
@@ -91,7 +93,7 @@ class robot_urllib(robot_base):
                 fname, headers = urllib.urlretrieve(url)
             finally:
                 if accept_charset and bookmark.charset:
-                    del urllib._urlopener.addheaders[-1] # Remove Accept-Charset
+                    del urllib._urlopener.addheaders[-1]  # Remove Accept-Charset
 
             infile = open(fname, 'rb')
             content = infile.read()
@@ -116,8 +118,9 @@ class robot_urllib(robot_base):
     def get_ftp_welcome(self):
         global ftpcache_key
         _welcome = urllib._urlopener.ftpcache[ftpcache_key].ftp.welcome
-        ftpcache_key = None # I am assuming there are no duplicate ftp URLs in db.
-                            # If there are - ftpcache_key in prev line is invalid.
+        # I am assuming there are no duplicate ftp URLs in db.
+        # If there are - ftpcache_key in next line is invalid.
+        ftpcache_key = None
         return _welcome
 
     def finish_check_url(self, bookmark):