From cffd0c62c8d9517b8441d2d86e6e75c25847569b Mon Sep 17 00:00:00 2001 From: Oleg Broytman Date: Sat, 5 Jul 2014 01:55:56 +0400 Subject: [PATCH] Allow to set default timeout from parameters Lower default timeout to 1 minute. --- Robots/bkmk_rurllib_to.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Robots/bkmk_rurllib_to.py b/Robots/bkmk_rurllib_to.py index 2726dbf..59a857d 100644 --- a/Robots/bkmk_rurllib_to.py +++ b/Robots/bkmk_rurllib_to.py @@ -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) -- 2.39.5