diff options
Diffstat (limited to 'gallery_dl/downloader')
| -rw-r--r-- | gallery_dl/downloader/common.py | 7 | ||||
| -rw-r--r-- | gallery_dl/downloader/http.py | 10 |
2 files changed, 8 insertions, 9 deletions
diff --git a/gallery_dl/downloader/common.py b/gallery_dl/downloader/common.py index 596c956..eca1284 100644 --- a/gallery_dl/downloader/common.py +++ b/gallery_dl/downloader/common.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -# Copyright 2014-2019 Mike Fährmann +# Copyright 2014-2020 Mike Fährmann # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License version 2 as @@ -20,10 +20,13 @@ class DownloaderBase(): def __init__(self, extractor, output): self.session = extractor.session self.out = output - self.log = logging.getLogger("downloader." + self.scheme) self.part = self.config("part", True) self.partdir = self.config("part-directory") + self.log = logging.getLogger("downloader." + self.scheme) + self.log.job = extractor.log.job + self.log.extractor = extractor + if self.partdir: self.partdir = util.expand_path(self.partdir) os.makedirs(self.partdir, exist_ok=True) diff --git a/gallery_dl/downloader/http.py b/gallery_dl/downloader/http.py index fab96ba..9cd2aa6 100644 --- a/gallery_dl/downloader/http.py +++ b/gallery_dl/downloader/http.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -# Copyright 2014-2019 Mike Fährmann +# Copyright 2014-2020 Mike Fährmann # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License version 2 as @@ -8,12 +8,11 @@ """Downloader module for http:// and https:// URLs""" -import os import time import mimetypes from requests.exceptions import RequestException, ConnectionError, Timeout from .common import DownloaderBase -from .. import text +from .. import text, util from ssl import SSLError try: @@ -57,10 +56,7 @@ class HttpDownloader(DownloaderBase): finally: # remove file from incomplete downloads if self.downloading and not self.part: - try: - os.unlink(pathfmt.temppath) - except (OSError, AttributeError): - pass + util.remove_file(pathfmt.temppath) def _download_impl(self, url, pathfmt): response = None |
