Esempio n. 1
0
    def get_content(self):
        # carga los datos del fichero o api en un array y lo devuelve
        # en el caso de carpeta deberia devolver un scandir
        if self._is_file():
            pathconf = core.get_path_in(self.get("path"))
            ojson = Json(pathconf)
            return ojson.get_loaded()
        elif self._is_api():
            # print("\nis_api():");print(self.dataid);sys.exit()
            if self.get("type") == "google-sheets":
                gsheets = Sheets(self.get("spread_id"),
                                 self.get("worksheet_num"))
                gsheets.set_credential(self.get("credentials"))
                return gsheets.get_data()
        elif self._is_folder():
            return {
                "pathfolder": self.get("path"),
                "files": self._get_files(self.get("path"))
            }

        return {"msg": "this context is not a file"}