def get_handler(self, protocol, server, remote_dir, list_file=None): """ Get a protocol download handler """ if list_file is None: list_file = [] downloader = None if protocol == "ftp" or protocol == "sftp": downloader = FTPDownload(protocol, server, remote_dir) if protocol == "http": downloader = HTTPDownload(protocol, server, remote_dir, self.bank.config) if protocol == "local": downloader = LocalDownload(remote_dir) if protocol == "directftp": downloader = DirectFTPDownload("ftp", server, remote_dir, list_file) if protocol == "directhttp": downloader = DirectHttpDownload("http", server, remote_dir, list_file) if downloader is not None: downloader.bank = self.bank.name proxy = self.bank.config.get("proxy") proxy_auth = self.bank.config.get("proxy_auth") if proxy is not None and proxy: downloader.set_proxy(proxy, proxy_auth) return downloader
def get_handler(self, protocol, server, remote_dir, list_file=None): ''' Get a protocol download handler ''' if list_file is None: list_file = [] downloader = None if protocol == 'ftp' or protocol == 'sftp': downloader = FTPDownload(protocol, server, remote_dir) if protocol == 'http': downloader = HTTPDownload(protocol, server, remote_dir, self.bank.config) if protocol == 'local': downloader = LocalDownload(remote_dir) if protocol == 'directftp': downloader = DirectFTPDownload('ftp', server, remote_dir, list_file) if protocol == 'directhttp': downloader = DirectHttpDownload('http', server, remote_dir, list_file) if downloader is not None: downloader.bank = self.bank.name proxy = self.bank.config.get('proxy') proxy_auth = self.bank.config.get('proxy_auth') if proxy is not None and proxy: downloader.set_proxy(proxy, proxy_auth) return downloader