]> git.phdru.name Git - bookmarks_db.git/blob - Robots/bkmk_rurllib_to.py
Fix simple robot with timeout
[bookmarks_db.git] / Robots / bkmk_rurllib_to.py
1 """Simple robot with socket's timeout
2
3 This file is a part of Bookmarks database and Internet robot.
4
5 """
6
7 __author__ = "Oleg Broytman <phd@phdru.name>"
8 __copyright__ = "Copyright (C) 2000-2014 PhiloSoft Design"
9 __license__ = "GNU GPL"
10
11 __all__ = ['robot_urllib_to']
12
13
14 import socket
15 socket.setdefaulttimeout(900)
16
17 from .bkmk_rurllib import robot_urllib, get_error
18
19
20 class robot_urllib_to(robot_urllib):
21    def check_url(self, bookmark):
22       try:
23          return robot_urllib.check_url(self, bookmark)
24       except socket.error, msg:
25          bookmark.error = get_error(msg)
26          self.log(bookmark.error)
27
28       return 1