From e2b5cd9918a52cedbf8853c5311ff46fd45b55bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20F=C3=A4hrmann?= Date: Sun, 26 Mar 2017 18:24:46 +0200 Subject: [PATCH] change config-path for 'retries' and 'timeout' --- gallery-dl.conf | 8 ++++++++ gallery_dl/downloader/common.py | 2 +- gallery_dl/downloader/http.py | 5 +++-- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/gallery-dl.conf b/gallery-dl.conf index 82fb39cb..111cc825 100644 --- a/gallery-dl.conf +++ b/gallery-dl.conf @@ -4,6 +4,14 @@ { "file": "/tmp/.gallery-dl.cache" }, + "downloader": + { + "http": + { + "retries": 5, + "timeout": null + } + }, "extractor": { "pixiv": diff --git a/gallery_dl/downloader/common.py b/gallery_dl/downloader/common.py index b82cd80f..55716223 100644 --- a/gallery_dl/downloader/common.py +++ b/gallery_dl/downloader/common.py @@ -28,5 +28,5 @@ class BasicDownloader(): except (OSError, AttributeError): pass - def download_impl(self, url, file_handle): + def download_impl(self, url, pathfmt): """Actual implementaion of the download process""" diff --git a/gallery_dl/downloader/http.py b/gallery_dl/downloader/http.py index 6ba2ac9d..5cd2f7a6 100644 --- a/gallery_dl/downloader/http.py +++ b/gallery_dl/downloader/http.py @@ -18,12 +18,13 @@ from .. import config class Downloader(BasicDownloader): + max_tries = config.interpolate(("downloader", "http", "retries",), 5) + timeout = config.interpolate(("downloader", "http", "timeout",), None) + def __init__(self, output): BasicDownloader.__init__(self) self.session = requests.session() self.out = output - self.max_tries = config.get(("retries",), 5) - self.timeout = config.get(("timeout",), None) def download_impl(self, url, pathfmt): tries = 0