add method to get old valid contact list
This commit is contained in:
@@ -11,7 +11,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/lpan/Desktop/contact_list_2024-06-17.xlsx")
|
||||
_contacts_to_book = read_contacts("/Users/lpan/Desktop/contact_list_2024-09-25.xlsx")
|
||||
return _contacts_to_book
|
||||
|
||||
|
||||
@@ -138,28 +138,49 @@ def generate_all_contact_list():
|
||||
write_new_contacts_to_excel(_all_contacts, file_name="all")
|
||||
|
||||
|
||||
def get_old_validated_contact_list():
|
||||
_valid_contact_list = MONGO_STORE_MANAGER.get_all_successful_items_for_one_day("2024-09-10")
|
||||
_all_contacts = MONGO_STORE_MANAGER.get_all_contacts_to_book()
|
||||
_contact_to_save = []
|
||||
for _contact in _valid_contact_list:
|
||||
# _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:
|
||||
_contact.last_name = _true_contact.last_name
|
||||
_contact.phone = _true_contact.phone
|
||||
_contact.passport = _true_contact.passport
|
||||
_contact.first_name = _true_contact.first_name
|
||||
|
||||
if _contact.url_validated:
|
||||
if _contact.last_name is not None and len(_contact.last_name) > 0:
|
||||
_need_to_save = True
|
||||
# remove the duplicated items
|
||||
for _added_item in _contact_to_save:
|
||||
if (_added_item.mail == _contact.mail
|
||||
and _added_item.phone == _contact.phone
|
||||
and _added_item.passport == _contact.passport
|
||||
and _added_item.last_name == _contact.last_name
|
||||
and _added_item.first_name == _contact.first_name):
|
||||
_need_to_save = False
|
||||
if _need_to_save:
|
||||
_contact_to_save.append(_contact)
|
||||
_contact_to_save_list = _contact_to_save
|
||||
write_new_contacts_to_excel(_contact_to_save_list)
|
||||
|
||||
|
||||
# 把新的联系人存到网上
|
||||
if __name__ == '__main__':
|
||||
# contacts_to_book = upload_contacts_list()
|
||||
# MONGO_STORE_MANAGER.upload_contact_list(contacts_to_book)
|
||||
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_contact_from_mail_list("/Users/panlei/Downloads/邮箱及密码.xlsx")
|
||||
# get_old_validated_contact_list()
|
||||
# generate_contact_from_mail_list("/Users/lpan/Downloads/邮箱及密码.xlsx")
|
||||
# print("end at {}".format(datetime.datetime.now()))
|
||||
generate_all_contact_list()
|
||||
# generate_all_contact_list()
|
||||
# merge_contact_list_files(
|
||||
# ["/Users/lpan/Desktop/contact_list_2024-05-07.xlsx",
|
||||
# "/Users/lpan/Desktop/contact_list_2024-05-06.xlsx",
|
||||
# "/Users/lpan/Desktop/contact_list_2024-05-04.xlsx",
|
||||
# "/Users/lpan/Desktop/contact_list_2024-05-03.xlsx",
|
||||
# "/Users/lpan/Desktop/contact_list_2024-05-02.xlsx",
|
||||
# "/Users/lpan/Desktop/contact_list_2024-04-30.xlsx",
|
||||
# "/Users/lpan/Desktop/contact_list_2024-04-26.xlsx",
|
||||
# "/Users/lpan/Desktop/contact_list_2024-04-25.xlsx",
|
||||
# "/Users/lpan/Desktop/contact_list_2024-04-24.xlsx",
|
||||
# "/Users/lpan/Desktop/contact_list_2024-04-23.xlsx",
|
||||
# "/Users/lpan/Desktop/contact_list_2024-04-22.xlsx",
|
||||
# "/Users/lpan/Desktop/contact_list_2024-04-20.xlsx",
|
||||
# "/Users/lpan/Desktop/contact_list_2024-04-18.xlsx",
|
||||
# "/Users/lpan/Desktop/contact_list_2024-04-19.xlsx"])
|
||||
# ["/Users/lpan/Desktop/contact_list_2024-06-24.xlsx",
|
||||
# "/Users/lpan/Desktop/contact_list_2024-06-25.xlsx"])
|
||||
# fix_phone_number_format("/Users/lpan/Desktop/15_05_to_test.xlsx")
|
||||
|
||||
Reference in New Issue
Block a user