]> git.phdru.name Git - bookmarks_db.git/blobdiff - check_url.py
Feat(Python3): Use print() function
[bookmarks_db.git] / check_url.py
index 123f6a92182b89c9d66f7647024cef72d52a5f34..8a6ec0aa5d2b11d6177d659422b0f4568856126c 100755 (executable)
@@ -1,10 +1,12 @@
 #! /usr/bin/env python
-"""
-   Robot interface - check one URL
+"""Robot interface - check URLs from the command line
 
-   Written by Broytman. Copyright (C) 2010 PhiloSoft Design.
+This file is a part of Bookmarks database and Internet robot.
 """
 
+__author__ = "Oleg Broytman <phd@phdru.name>"
+__copyright__ = "Copyright (C) 2010-2017 PhiloSoft Design"
+__license__ = "GNU GPL"
 
 import sys
 import httplib
@@ -20,11 +22,10 @@ httplib.HTTP = MyHTTP
 
 from bkmk_objects import Bookmark
 from Writers.bkmk_wflad import strftime
-tempfname = "check_url.tmp"
 
 
 def run():
-   print "Broytman check_url, Copyright (C) 2010 PhiloSoft Design"
+   print("Broytman check_url, Copyright (C) 2010-2017 PhiloSoft Design")
 
    if len(sys.argv) < 2:
       sys.stderr.write("Usage: check_url.py url1 [url2...]\n")
@@ -34,26 +35,26 @@ def run():
    log = makelog("check.log")
 
    from robots import robot
-   robot = robot(tempfname, log)
+   robot = robot(log)
 
    for url in sys.argv[1:]:
        bookmark = Bookmark(href=url, add_date=None)
        bookmark.parent = None
 
        rcode = robot.check_url(bookmark)
-       print "check_url: %s" % rcode
+       print("check_url: %s" % rcode)
 
        if hasattr(bookmark, 'error'):
-          print bookmark.error
+          print(bookmark.error)
 
        else:
-          print """\
+          print("""\
 URL: %s
 Title: %s
 LastModified: %s
 IconURI: %s
 Icon: %s
-""" % (bookmark.href, getattr(bookmark, 'real_title', ''), strftime(bookmark.last_modified), bookmark.icon_href, bookmark.icon)
+""" % (bookmark.href, getattr(bookmark, 'real_title', ''), strftime(bookmark.last_modified), bookmark.icon_href, bookmark.icon))
 
    robot.stop()
    log.close()