def download_all(self, session, file): # read the filelist newfiles = session.nlst() self.log.debug("Got a file list: "+newfiles) local_dir = self.download_dir + '/' + NoaaCycle.current_date() files = newfiles.splitlines() [self.download(session, local_dir, file) for file in files]
def action(self): file = NoaaCycle.current_file() local_dir = self.download_dir + '/' + NoaaCycle.current_date() # 2do select FTP client depending on configuration (development|production) # mock-up client for a while session = FTP2(self.ftp_host) self.log.info("Connected to %s" % self.ftp_host) self.log.info("Downloading %s/%s" % (self.remote_dir, file)) try: session.login() session.cwd(self.remote_dir) self.download(session, local_dir, file) except Exception, e: self.log.error("%s" % e)