-#! /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.
"""
__author__ = "Oleg Broytman <phd@phdru.name>"
-__copyright__ = "Copyright (C) 2010-2017 PhiloSoft Design"
+__copyright__ = "Copyright (C) 2010-2023 PhiloSoft Design"
__license__ = "GNU GPL"
import sys
-import httplib
-HTTP = httplib.HTTP
+from bkmk_objects import Bookmark
+from Writers.bkmk_wflad import strftime
-class MyHTTP(HTTP):
- def _setup(self, conn):
- HTTP._setup(self, conn)
- self.set_debuglevel(1)
+try:
+ import httplib
+except ImportError:
+ pass
+else:
+ HTTP = httplib.HTTP
-httplib.HTTP = MyHTTP
+ class MyHTTP(HTTP):
+ def _setup(self, conn):
+ HTTP._setup(self, conn)
+ self.set_debuglevel(1)
-from bkmk_objects import Bookmark
-from Writers.bkmk_wflad import strftime
+ httplib.HTTP = MyHTTP
def run():
- print("Broytman check_url, Copyright (C) 2010-2017 PhiloSoft Design")
+ print("Broytman check_url, Copyright (C) 2010-2023 PhiloSoft Design")
if len(sys.argv) < 2:
sys.stderr.write("Usage: check_url.py url1 [url2...]\n")
from m_lib.flog import makelog
log = makelog("check.log")
+ log.outfile.reconfigure(encoding='utf-8')
from robots import robot
robot = robot(log)
LastModified: %s
IconURI: %s
Icon: %s
- """ % (bookmark.href, getattr(bookmark, 'real_title', ''), strftime(bookmark.last_modified), bookmark.icon_href, bookmark.icon))
+ Charset: %s
+ """ % (
+ bookmark.href, getattr(bookmark, 'real_title', ''),
+ strftime(bookmark.last_modified), bookmark.icon_href,
+ bookmark.icon, bookmark.charset))
robot.stop()
log.close()