change phonenumber prefix

This commit is contained in:
2025-03-27 20:34:00 +01:00
parent 2f781ad544
commit b6b94cb58a
2 changed files with 27 additions and 13 deletions
+14 -9
View File
@@ -18,7 +18,7 @@ DEFAULT_SERIAL_TO_IGNORE = ["47e7e36b", "bitbrowser"]
def upload_contacts_list():
_contacts_to_book = read_contacts(str(Path.home()) + "/Desktop/contact_list_2025-03-08_aol_400.xlsx")
_contacts_to_book = read_contacts(str(Path.home()) + "/Desktop/extracted_aol_contacts_292_24_03_mac.xlsx")
return _contacts_to_book
@@ -33,10 +33,15 @@ def fix_phone_number_format(file_path):
_contact.first_name = original_last_name.replace("\xa0", " ").split(" ")[1]
print(_contact)
if _contact.phone.startswith('7'):
if _contact.phone[0:2] not in fr_phone_number_prefix:
_need_to_fix = True
for prefix in fr_phone_number_prefix:
if _contact.phone.startswith(prefix):
_need_to_fix = False
# if _contact.phone[0:2] not in fr_phone_number_prefix:
if _need_to_fix:
print(_contact)
_contact.phone = get_random_fr_phone_numbers()
write_new_contacts_to_excel(_contact_list, file_name="15_05_to_test")
write_new_contacts_to_excel(_contact_list, file_name="real_name_contacts_500_27_03_25_fixed")
def generate_contact_from_mail_list(mail_list_file,
@@ -94,7 +99,7 @@ def write_new_contacts_to_excel(valid_contacts: list, file_name=str(datetime.dat
def generate_valid_contact_list_for_day(segment_number=1):
_collection_name = "2025-03-12"
_collection_name = "2025-03-14"
_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 = []
@@ -243,13 +248,13 @@ def write_resident_card_number_to_contact_list(file_to_read, file_name="contact_
if __name__ == '__main__':
# write_resident_card_number_to_contact_list(file_to_read=str(Path.home()) + "/Desktop/contact_list_all_12.xlsx",
# file_name="contact_list_all_12")
# write_resident_card_number_to_contact_list(file_to_read=str(Path.home()) + "/Desktop/contact_list_all_13.xlsx",
# file_name="contact_list_all_13")
# 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/lpan/Downloads/邮箱及密码_aol_400_08_03_2025.xlsx")
# 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()
# get_old_validated_contact_list()
@@ -261,4 +266,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("/Users/lpan/Desktop/15_05_to_test.xlsx")
fix_phone_number_format(str(Path.home()) + "/Desktop/real_name_contacts_500_27_03_25.xlsx")