From: Oleg Broytman Date: Fri, 4 Jul 2014 21:55:56 +0000 (+0400) Subject: Allow to set default timeout from parameters X-Git-Tag: v4.6.0~14 X-Git-Url: https://git.phdru.name/?a=commitdiff_plain;h=cffd0c62c8d9517b8441d2d86e6e75c25847569b;p=bookmarks_db.git Allow to set default timeout from parameters Lower default timeout to 1 minute. --- 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)