diff --git a/slpkg/downloader.py b/slpkg/downloader.py index c7dc409a..5f4044c7 100644 --- a/slpkg/downloader.py +++ b/slpkg/downloader.py @@ -25,7 +25,12 @@ class Downloader(Configs): self.filename = None self.downloader_command: str = str() - + self.downloader_tools: dict = { + 'wget': self.wget_downloader, + 'wget2': self.wget_downloader, + 'curl': self.curl_downloader, + 'lftp': self.lftp_downloader + } self.option_for_parallel: bool = self.utils.is_option( ['-P', '--parallel'], flags) @@ -50,18 +55,11 @@ class Downloader(Configs): path: str = urlparse(url).path self.filename: str = unquote(Path(path).name) - downloader_tool: dict = { - 'wget': self.wget_downloader, - 'wget2': self.wget_downloader, - 'curl': self.curl_downloader, - 'lftp': self.lftp_downloader - } - if url.startswith('file'): self.copy_local_binary_file(url) else: try: - downloader_tool[self.downloader](url) + self.downloader_tools[self.downloader](url) except KeyError: self.errors.raise_error_message(f"Downloader '{self.downloader}' not supported", exit_status=1)