From 5579129b11f4acc9d0dc019cb4cb8b6533371cbb Mon Sep 17 00:00:00 2001 From: JustAnotherArchivist Date: Sat, 20 Nov 2021 23:44:35 +0000 Subject: [PATCH] Support overriding the total fetch timeout --- qwarc/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/qwarc/__init__.py b/qwarc/__init__.py index 425d8f5..ef1d841 100644 --- a/qwarc/__init__.py +++ b/qwarc/__init__.py @@ -34,7 +34,7 @@ class Item: self.childItems = [] - async def fetch(self, url, responseHandler = qwarc.utils.handle_response_default, method = 'GET', data = None, headers = [], verify_ssl = True): + async def fetch(self, url, responseHandler = qwarc.utils.handle_response_default, method = 'GET', data = None, headers = [], verify_ssl = True, timeout = 60): ''' HTTP GET or POST a URL @@ -65,7 +65,7 @@ class Item: writeToWarc = True try: try: - with _aiohttp.Timeout(60): + with _aiohttp.Timeout(timeout): self.logger.info(f'Fetching {url}') response = await self.session.request(method, url, data = data, headers = headers, allow_redirects = False, verify_ssl = verify_ssl) try: