add store when generate contact list

This commit is contained in:
2024-03-24 18:27:41 +01:00
parent b37d612467
commit 66cf924b0b
+10 -7
View File
@@ -8,7 +8,7 @@ from src.utils.excel_reader import read_contacts, fr_phone_number_prefix, get_ra
def upload_contacts_list():
_contacts_to_book = read_contacts("/Users/panlei/Desktop/contact_list_2024-02-29.xlsx")
_contacts_to_book = read_contacts("/Users/panlei/Desktop/contact_list_2024-03-23.xlsx")
return _contacts_to_book
@@ -19,7 +19,7 @@ def fix_phone_number_format(file_path):
if _contact.phone[0:2] not in fr_phone_number_prefix:
print(_contact)
_contact.phone = get_random_fr_phone_numbers()
write_new_contacts_to_excel(_contact_list, file_name="yahoo_aol_valid_26-1")
write_new_contacts_to_excel(_contact_list, file_name="23_03_to_test")
def write_new_contacts_to_excel(valid_contacts: list, file_name=str(datetime.date.today())):
@@ -51,7 +51,8 @@ def generate_valid_contact_list_for_day():
_all_contacts = MONGO_STORE_MANAGER.get_all_contacts_to_book()
_contact_to_save = []
for _contact in _valid_contact_list:
_contact.store = "faubourg"
# _contact.store = "faubourg"
_contact.store = "random"
if _contact.last_name is None or len(_contact.last_name) == 0:
for _true_contact in _all_contacts:
if _true_contact.mail == _contact.mail:
@@ -68,13 +69,15 @@ def generate_valid_contact_list_for_day():
def generate_all_contact_list():
_all_contacts = MONGO_STORE_MANAGER.get_all_contacts_to_book()
random.shuffle(_all_contacts)
for _contact in _all_contacts:
_contact.store = "random"
write_new_contacts_to_excel(_all_contacts, file_name="all")
# 把新的联系人存到网上
if __name__ == '__main__':
# contacts_to_book = upload_contacts_list()
# MONGO_STORE_MANAGER.upload_contact_list(contacts_to_book)
generate_valid_contact_list_for_day()
contacts_to_book = upload_contacts_list()
MONGO_STORE_MANAGER.upload_contact_list(contacts_to_book)
# generate_valid_contact_list_for_day()
# generate_all_contact_list()
# fix_phone_number_format("/Users/lpan/Desktop/yahoo_aol_valid_26-1.xlsx")
# fix_phone_number_format("/Users/panlei/Desktop/23_03_to_test.xlsx")