added resident_card_number field
This commit is contained in:
@@ -5,7 +5,6 @@ from pathlib import Path
|
||||
import xlsxwriter
|
||||
|
||||
from src.db.mongo_manager import MONGO_STORE_MANAGER
|
||||
from src.person_name.cython_extract_methods import filter_already_validated_contacts, read_pinyin_list_from_file
|
||||
from src.pojo.contact_pojo import ContactPojo
|
||||
from src.utils.contacts.generate_random_passport_id import generate_single_titre_sejour_number
|
||||
from src.utils.excel_reader import read_contacts, fr_phone_number_prefix, get_random_fr_phone_numbers, ExcelHelper
|
||||
@@ -17,7 +16,7 @@ DEFAULT_SERIAL_TO_IGNORE = ["47e7e36b", "bitbrowser"]
|
||||
|
||||
|
||||
def upload_contacts_list():
|
||||
_contacts_to_book = read_contacts(str(Path.home()) + "/Desktop/contact_list_200_aol_10_01_2025.xlsx")
|
||||
_contacts_to_book = read_contacts(str(Path.home()) + "/Desktop/contact_list_2025-01-24.xlsx")
|
||||
return _contacts_to_book
|
||||
|
||||
|
||||
@@ -57,7 +56,7 @@ def generate_contact_from_mail_list(mail_list_file,
|
||||
name = random.choice(pinyin_name_list)
|
||||
last_name = name.split(" ")[0]
|
||||
first_name = name.split(" ")[1]
|
||||
contact = ContactPojo(mail=mail.mail, phone_number=phone_number, passport_number=passport_number,
|
||||
contact = ContactPojo(mail=mail.mail, phone_number=phone_number, passport=passport_number,
|
||||
last_name=last_name, first_name=first_name, store="random")
|
||||
generate_contacts.append(contact)
|
||||
write_new_contacts_to_excel(generate_contacts)
|
||||
@@ -68,7 +67,8 @@ def write_new_contacts_to_excel(valid_contacts: list, file_name=str(datetime.dat
|
||||
col = 0
|
||||
# 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']
|
||||
header_data = ['name', 'phone', 'passport', 'email', 'store', 'serial', 'ip_country', 'ua',
|
||||
'resident_card_number']
|
||||
worksheet = workbook.add_worksheet()
|
||||
header_format = workbook.add_format({'bold': True})
|
||||
|
||||
@@ -85,12 +85,13 @@ def write_new_contacts_to_excel(valid_contacts: list, file_name=str(datetime.dat
|
||||
worksheet.write(row, col + 5, info.serial)
|
||||
worksheet.write(row, col + 6, info.ip_country)
|
||||
worksheet.write(row, col + 7, info.ua)
|
||||
worksheet.write(row, col + 8, info.resident_card_number)
|
||||
row += 1
|
||||
workbook.close()
|
||||
|
||||
|
||||
def generate_valid_contact_list_for_day(segment_number=1):
|
||||
_collection_name = "2025-01-14"
|
||||
_collection_name = "2025-01-24"
|
||||
_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 = []
|
||||
@@ -104,6 +105,10 @@ def generate_valid_contact_list_for_day(segment_number=1):
|
||||
_contact.phone = _true_contact.phone
|
||||
_contact.passport = _true_contact.passport
|
||||
_contact.first_name = _true_contact.first_name
|
||||
if _contact.resident_card_number is None or len(_contact.resident_card_number) == 0:
|
||||
for _true_contact in _all_contacts:
|
||||
if _true_contact.mail == _contact.mail:
|
||||
_contact.resident_card_number = _true_contact.resident_card_number
|
||||
|
||||
# if len(_contact.serial) == 0:
|
||||
# _contact.serial = DEFAULT_SERIAL
|
||||
@@ -165,8 +170,9 @@ def generate_all_contact_list():
|
||||
random.shuffle(_all_contacts)
|
||||
for _contact in _all_contacts:
|
||||
_contact.store = "random"
|
||||
_contact.resident_card_number = generate_single_titre_sejour_number()
|
||||
write_new_contacts_to_excel(_all_contacts, file_name="all")
|
||||
write_list_with_segment_number("all", _all_contacts, 31)
|
||||
write_list_with_segment_number("all", _all_contacts, 1)
|
||||
|
||||
|
||||
def write_to_black_list(contacts: list):
|
||||
@@ -224,17 +230,16 @@ def get_old_validated_contact_list(remove_blacklisted_contact=True, _day_in_str=
|
||||
|
||||
# 把新的联系人存到网上
|
||||
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/lpan/Downloads/邮箱及密码_yahoo_100_16_01_2025.xlsx")
|
||||
# print("end at {}".format(datetime.datetime.now()))
|
||||
# update_contact_list_not_received_mail()
|
||||
# generate_valid_contact_list_for_day(segment_number=2)
|
||||
# get_old_validated_contact_list()
|
||||
# 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-11-04.xlsx",
|
||||
# "/Users/lpan/Desktop/contact_list_2024-11-07.xlsx",
|
||||
|
||||
@@ -203,7 +203,7 @@ def write_new_contacts_to_excel(valid_contacts: list):
|
||||
|
||||
|
||||
def find_contact(generate_contacts: list, mail, pinyin_name_list):
|
||||
contact = ContactPojo(mail=mail.mail, phone_number="", passport_number="", last_name="", first_name="",
|
||||
contact = ContactPojo(mail=mail.mail, phone_number="", passport="", last_name="", first_name="",
|
||||
store="random")
|
||||
splitted = mail.mail.split("@")
|
||||
possible_name_list = generate_name_from_email(splitted[0], pinyin_name_list)
|
||||
|
||||
Reference in New Issue
Block a user