From: Oleg Broytman Date: Tue, 10 Sep 2024 12:32:54 +0000 (+0300) Subject: Feat(Robots): Removed ftp_timeout X-Git-Url: https://git.phdru.name/?a=commitdiff_plain;h=cf8559acc3d5487d40fcc024f17c0d4abdec8736;p=bookmarks_db.git Feat(Robots): Removed ftp_timeout --- diff --git a/Robots/base.py b/Robots/base.py index fa7178a..b2e2dd9 100644 --- a/Robots/base.py +++ b/Robots/base.py @@ -79,12 +79,11 @@ class robot_base(Robot): proxy_error = set() timeout = 60 - ftp_timeout = 60 report_checked = True def __init__(self, *args, **kw): - for attr in 'timeout', 'ftp_timeout': + for attr in ['timeout']: value = getattr(self, attr) if not isinstance(value, int): value = int(value) diff --git a/Robots/bkmk_raio.py b/Robots/bkmk_raio.py index 65c2234..42a766f 100644 --- a/Robots/bkmk_raio.py +++ b/Robots/bkmk_raio.py @@ -68,7 +68,7 @@ class robot_aio(multi_mixin, robot_base): async def get(self, url, req_headers, use_proxy=False): if url.startswith('ftp://'): error, body = await _get_ftp( - url, timeout=self.ftp_timeout, + url, timeout=self.timeout, ) if error is not None: error = str(error) diff --git a/Robots/bkmk_rcurl.py b/Robots/bkmk_rcurl.py index c304454..6407153 100644 --- a/Robots/bkmk_rcurl.py +++ b/Robots/bkmk_rcurl.py @@ -85,12 +85,8 @@ class CurlWrapper: curl.setopt(pycurl.SSL_VERIFYPEER, 0) curl.setopt(curl.CAINFO, certifi.where()) # Set timeouts to avoid hanging too long - if url.startswith('ftp://'): - timeout = robot.ftp_timeout - else: - timeout = robot.timeout - curl.setopt(pycurl.CONNECTTIMEOUT, timeout) - curl.setopt(pycurl.TIMEOUT, timeout) + curl.setopt(pycurl.CONNECTTIMEOUT, robot.timeout) + curl.setopt(pycurl.TIMEOUT, robot.timeout) # Parse Last-Modified curl.setopt(pycurl.OPT_FILETIME, 1) diff --git a/Robots/bkmk_rtwisted.py b/Robots/bkmk_rtwisted.py index 34a5fad..f5f2f29 100644 --- a/Robots/bkmk_rtwisted.py +++ b/Robots/bkmk_rtwisted.py @@ -102,11 +102,7 @@ class robot_twisted(cf_multithread): continue # Setup timeout watch - if url.startswith('ftp://'): - timeout = self.ftp_timeout - else: - timeout = self.timeout - timeoutCall = reactor.callLater(timeout, d.cancel) + timeoutCall = reactor.callLater(self.timeout, d.cancel) d.addBoth(self.cancelTimeout, timeoutCall) d.addCallback(self.cbRequest, queue, timeoutCall) diff --git a/doc/ANNOUNCE b/doc/ANNOUNCE index c0fa340..7239608 100644 --- a/doc/ANNOUNCE +++ b/doc/ANNOUNCE @@ -17,6 +17,8 @@ Version 6.2.0 (2024-??-??) Default list of robots is still multirequests,aio. + Robots: Removed ftp_timeout. + WHERE TO GET Home page: https://phdru.name/Software/Python/#bookmarks_db diff --git a/doc/ChangeLog b/doc/ChangeLog index 9182c44..50750a4 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -8,6 +8,8 @@ Version 6.2.0 (2024-??-??) Default list of robots is still multirequests,aio. + Robots: Removed ftp_timeout. + Version 6.1.0 (2024-09-08) Combine aiohttp with multiaio; the combined robot is named just aio.