Exemple #1
0
 def __init__(self, debug=False, host='0.0.0.0', port=5000):
     self.app = Flask(__name__, static_folder=os.path.join(os.getcwd(), ONG_FOLDER),
                      static_url_path=os.path.join(HOST, ONG_FOLDER))
     self.app_config()
     self.host = host
     self.port = port
     self.debug = debug
     self.session = Session()
Exemple #2
0
def main():
    documents_dict = gather_all_documents()

    # save documents
    documents_mod = list(map(convert_to_document, documents_dict))
    new_documents = remove_duplicates(documents_mod)

    session = Session()

    session.bulk_save_objects(new_documents)

    try:
        session.commit()
    except Exception as ex:
        session.rollback()
    finally:
        session.close()

    for doc in new_documents:
        doc.download()