__all__ = ['robot_base', 'get_error']
-import sys
-import time, urllib
from base64 import b64encode
+import sys
+import socket
+import time
+import urllib
from urlparse import urljoin
-from m_lib.net.www.util import parse_time
from m_lib.md5wrapper import md5wrapper
+from m_lib.net.www.util import parse_time
from bkmk_objects import Robot
from parse_html import parse_html
# or None if there is no icon.
class robot_base(Robot):
+ timeout = 60
+
+ def __init__(self, *args, **kw):
+ Robot.__init__(self, *args, **kw)
+ socket.setdefaulttimeout(int(self.timeout))
+
def check_url(self, bookmark):
try:
self.start = int(time.time())
self.log("Keyboard interrupt (^C)")
return 0
+ except socket.error, e:
+ bookmark.error = get_error(e)
+ self.log(bookmark.error)
+
except:
import traceback
traceback.print_exc()
+++ /dev/null
-"""Simple robot with socket's timeout
-
-This file is a part of Bookmarks database and Internet robot.
-
-"""
-
-__author__ = "Oleg Broytman <phd@phdru.name>"
-__copyright__ = "Copyright (C) 2000-2014 PhiloSoft Design"
-__license__ = "GNU GPL"
-
-__all__ = ['robot_urllib_to']
-
-
-import socket
-from .bkmk_rurllib import robot_urllib, get_error
-
-
-class robot_urllib_to(robot_urllib):
- timeout = 60
-
- def __init__(self, *args, **kw):
- robot_urllib.__init__(self, *args, **kw)
- socket.setdefaulttimeout(int(self.timeout))
-
- def check_url(self, bookmark):
- try:
- return robot_urllib.check_url(self, bookmark)
- except socket.error, msg:
- bookmark.error = get_error(msg)
- self.log(bookmark.error)
- return 1
-Robot based on urllib2: handle timeout and ftp.
+Robot based on urllib2: handle ftp (welcome message).
A new robot based on PycURL.