]> git.phdru.name Git - bookmarks_db.git/blobdiff - check_url.py
Fix(robots): Do not parse empty strings
[bookmarks_db.git] / check_url.py
index ecaa2fb26582f1daf12209b803fc64dca3b19bbf..697d6775d04f4abdd48abc039e38faa37e533959 100755 (executable)
@@ -1,4 +1,4 @@
-#! /usr/bin/env python
+#! /usr/bin/env python3
 """Robot interface - check URLs from the command line
 
 This file is a part of Bookmarks database and Internet robot.
@@ -9,21 +9,23 @@ __copyright__ = "Copyright (C) 2010-2023 PhiloSoft Design"
 __license__ = "GNU GPL"
 
 import sys
-import httplib
 
 from bkmk_objects import Bookmark
 from Writers.bkmk_wflad import strftime
 
-HTTP = httplib.HTTP
+try:
+    import httplib
+except ImportError:
+    pass
+else:
+    HTTP = httplib.HTTP
 
+    class MyHTTP(HTTP):
+        def _setup(self, conn):
+            HTTP._setup(self, conn)
+            self.set_debuglevel(1)
 
-class MyHTTP(HTTP):
-    def _setup(self, conn):
-        HTTP._setup(self, conn)
-        self.set_debuglevel(1)
-
-
-httplib.HTTP = MyHTTP
+    httplib.HTTP = MyHTTP
 
 
 def run():
@@ -35,6 +37,7 @@ def run():
 
     from m_lib.flog import makelog
     log = makelog("check.log")
+    log.outfile.reconfigure(encoding='utf-8')
 
     from robots import robot
     robot = robot(log)