Ejemplo n.º 1
0
 def read_info_from_yaml(cls, *wants) -> dict:
     if not os.path.exists(cls.temp_net_info_file):
         network_information = cls.save_info_to_yaml()
     else:
         network_information = YamlOperator(cls.temp_net_info_file).read()
     if not wants:
         return network_information
     return dict(
         ([(key, network_information.get(key, "")) for key in wants]))
 def get_key_dict(self, key="user"):
     self.ftp.download_file(self.remote_base_file('path'), self.file_path)
     time.sleep(2)
     yaml_obj = YamlOperator(self.file_path).read()
     return yaml_obj.get(key, {})