50 lines
1.2 KiB
Python
50 lines
1.2 KiB
Python
import os
|
|
import re
|
|
import traceback
|
|
import json
|
|
from dotenv import load_dotenv
|
|
from config_base import *
|
|
from elastic_helper import ElasticHelper
|
|
import pandas as pd
|
|
from qanon_functions import *
|
|
|
|
|
|
def importBeforeInfosToElastic(elastic, file_excel, index_name_o, tcode_label, tcode_id , file_log, result_path = ""):
|
|
df = pd.read_excel(file_excel, sheet_name=0, header=None)
|
|
count = 0
|
|
rows_list = df.to_dict(orient='records')
|
|
total = len(df[0])
|
|
print('total : ', total)
|
|
|
|
column_names = df.columns.tolist()
|
|
print(column_names)
|
|
|
|
file = open(file_log, 'w+', encoding='utf8')
|
|
|
|
dict_qanon_id = get_dict_qanon_title("qanon_title_ids.txt")
|
|
# Print the list of rows
|
|
dic_error_qanon_title={}
|
|
dic_error_section_title={}
|
|
rows_list_new = []
|
|
bulk_data = []
|
|
total_count=0
|
|
|
|
|
|
load_dotenv(dotenv_path='config.env')
|
|
|
|
# host=os.getenv('HOST_160')
|
|
# password=os.getenv('HOST_160_PASS')
|
|
|
|
# host=os.getenv('HOST_112')
|
|
# password=os.getenv('HOST_112_PASS')
|
|
|
|
host=os.getenv('HOST_113')
|
|
password=os.getenv('HOST_113_PASS')
|
|
|
|
print(password)
|
|
|
|
path_base_map = "G:/Project2/gateway2_main/repo/_other/"
|
|
elastic = ElasticHelper(host, password, "elastic", path_base_map)
|
|
|
|
|
|
#importBeforeInfosToElastic(elastic, "./data/tcodes", "./data/tcodes/result") |