temples['imgUrl_5'] = xls.GetSheetValue(row, col_imgUrl_5) temples['place'] = xls.GetSheetValue(row, col_place) temples['surPlace'] = helper.remove_substring( xls.GetSheetValue(row, col_place)) temples['longBrief'] = helper.capitalize_first( xls.GetSheetValue(row, col_longBrief)) \ .replace('\t', ' ').replace(' ', ' ') temples['srcUrl'] = xls.GetSheetValue(row, col_srcUrl) temples['eparchyUrl'] = xls.GetSheetValue(row, col_eparchyUrl) temples['abbots'] = helper.capitalize_first( xls.GetSheetValue(row, col_abbots)) entities.append(temples) except Exception as e: print(f'Exception input line in row {row}: {temples}') raise Exception(e) helper.clear_folder(helper.get_full_path(root_folder)) helper.create_folder(helper.get_full_path(root_folder)) for i in range(len(entities)): item = entities[i] filename = 'file{}.json'.format(i) filename = helper.get_full_path(os.path.join(root_folder, filename)) helper.save_json(item, filename) print("Completed read to json files") exit(0)
import pymongo import helper import filehelper client = pymongo.MongoClient('mongodb://localhost:27017/') database = client['app'] chronos_coll = database['chronos'] root_folder = helper.get_full_path('out_chronos') print(root_folder) files = filehelper.get for filename in files: print(filename) break for post in chronos_coll.find({}): print(post) break