]> git.phdru.name Git - bookmarks_db.git/commitdiff
Allow to set default timeout from parameters
authorOleg Broytman <phd@phdru.name>
Fri, 4 Jul 2014 21:55:56 +0000 (01:55 +0400)
committerOleg Broytman <phd@phdru.name>
Fri, 4 Jul 2014 21:55:56 +0000 (01:55 +0400)
Lower default timeout to 1 minute.

Robots/bkmk_rurllib_to.py

index 2726dbfc3df1d6d5c829e50a41dd780afd7e56c2..59a857db168f3cca768b0b26c9597561624e7be5 100644 (file)
@@ -12,12 +12,16 @@ __all__ = ['robot_urllib_to']
 
 
 import socket
-socket.setdefaulttimeout(900)
-
 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)