def __getModulesFromConfig(self, modules, config_array_name): try: modules_from_config = self.__config['MODULES'][config_array_name] except: logger.Warning('config.json : modules bad format') modules_from_config = [] if len(modules_from_config) == 0 and modules is None: return None if len(modules_from_config) == 0 and modules is not None: return modules if modules is None: modules = [] for module in modules_from_config: if module in modules: logger.Warning('warning : ' + module + ' already referenced.') modules.append(module) return modules
def download(self): url = self.observation[self.__json_id] if not url: logger.Info('no archive found for the observation ' + str(self.observation['id']) + ' of ' + self.observation['start']) return fileHelper.create_dir_if_not_exist(self.full_path) file_name = ntpath.basename(url) full_path_file = self.full_path + os.path.sep + file_name if os.path.exists(full_path_file): logger.Warning('pass ' + file_name + '... file already exist') return r = self.client.get(url) if r.status_code == 200: logger.Info('downloading archive...' + file_name) with open(full_path_file, "wb") as file: file.write(r.content) self.runModulesAfterDownload(file_name)