added source_from field to contactPojo
This commit is contained in:
@@ -18,7 +18,7 @@ DEFAULT_SERIAL_TO_IGNORE = ["47e7e36b", "bitbrowser"]
|
||||
|
||||
|
||||
def upload_contacts_list():
|
||||
_contacts_to_book = read_contacts(str(Path.home()) + "/Desktop/extracted_aol_contacts_292_24_03_mac.xlsx")
|
||||
_contacts_to_book = read_contacts(str(Path.home()) + "/Desktop/extracted_yahoo_contacts_129_24_03_win.xlsx")
|
||||
return _contacts_to_book
|
||||
|
||||
|
||||
@@ -76,7 +76,7 @@ def write_new_contacts_to_excel(valid_contacts: list, file_name=str(datetime.dat
|
||||
# Create a workbook and add a worksheet.
|
||||
workbook = xlsxwriter.Workbook('contact_list_{}.xlsx'.format(file_name))
|
||||
header_data = ['name', 'phone', 'passport', 'email', 'store', 'serial', 'ip_country', 'ua',
|
||||
'resident_card_number']
|
||||
'resident_card_number', 'source_from']
|
||||
worksheet = workbook.add_worksheet()
|
||||
header_format = workbook.add_format({'bold': True})
|
||||
|
||||
@@ -94,12 +94,13 @@ def write_new_contacts_to_excel(valid_contacts: list, file_name=str(datetime.dat
|
||||
worksheet.write(row, col + 6, info.ip_country)
|
||||
worksheet.write(row, col + 7, info.ua)
|
||||
worksheet.write(row, col + 8, info.resident_card_number)
|
||||
worksheet.write(row, col + 9, info.source_from)
|
||||
row += 1
|
||||
workbook.close()
|
||||
|
||||
|
||||
def generate_valid_contact_list_for_day(segment_number=1):
|
||||
_collection_name = "2025-03-14"
|
||||
_collection_name = "2025-03-27"
|
||||
_valid_contact_list = MONGO_STORE_MANAGER.get_all_successful_items_for_one_day(_collection_name)
|
||||
_all_contacts = MONGO_STORE_MANAGER.get_all_contacts_to_book()
|
||||
_contact_to_save = []
|
||||
@@ -148,11 +149,20 @@ def generate_valid_contact_list_for_day(segment_number=1):
|
||||
|
||||
|
||||
def write_list_with_segment_number(file_name, _contact_to_save_list, segment_number):
|
||||
for i in range(0, segment_number):
|
||||
_step = int(len(_contact_to_save_list) / segment_number)
|
||||
_sublist = _contact_to_save_list[i * _step:_step * (i + 1)]
|
||||
_file_name = file_name + "_" + str(i + 1)
|
||||
write_new_contacts_to_excel(_sublist, file_name=_file_name)
|
||||
_mac_list = []
|
||||
_win_list = []
|
||||
for _contact in _contact_to_save_list:
|
||||
if _contact.source_from == "rdv" or _contact.source_from == "lpan":
|
||||
_mac_list.append(_contact)
|
||||
else:
|
||||
_win_list.append(_contact)
|
||||
write_new_contacts_to_excel(_mac_list, file_name=file_name + "_mac")
|
||||
write_new_contacts_to_excel(_win_list, file_name=file_name + "_win")
|
||||
# for i in range(0, segment_number):
|
||||
# _step = int(len(_contact_to_save_list) / segment_number)
|
||||
# _sublist = _contact_to_save_list[i * _step:_step * (i + 1)]
|
||||
# _file_name = file_name + "_" + str(i + 1)
|
||||
# write_new_contacts_to_excel(_sublist, file_name=_file_name)
|
||||
|
||||
|
||||
def merge_contact_list_files(file_list: list, final_file_name="merged_contact_list"):
|
||||
@@ -253,7 +263,7 @@ if __name__ == '__main__':
|
||||
# contacts_to_book = upload_contacts_list()
|
||||
# MONGO_STORE_MANAGER.upload_contact_list(contacts_to_book)
|
||||
# print("start at {}".format(datetime.datetime.now()))
|
||||
# generate_valid_contact_list_for_day(segment_number=2)
|
||||
generate_valid_contact_list_for_day(segment_number=2)
|
||||
# generate_contact_from_mail_list("/Users/lpan/Downloads/邮箱及密码_23_03_25_yahoo.xlsx")
|
||||
# print("end at {}".format(datetime.datetime.now()))
|
||||
# update_contact_list_not_received_mail()
|
||||
@@ -266,4 +276,4 @@ if __name__ == '__main__':
|
||||
# "/Users/lpan/Desktop/contact_list_2024-11-08.xlsx",
|
||||
# "/Users/lpan/Desktop/contact_list_2024-11-06.xlsx"
|
||||
# ])
|
||||
fix_phone_number_format(str(Path.home()) + "/Desktop/real_name_contacts_500_27_03_25.xlsx")
|
||||
# fix_phone_number_format(str(Path.home()) + "/Desktop/real_name_contacts_292_win.xlsx")
|
||||
|
||||
Reference in New Issue
Block a user