added methode to generate check_name excel

This commit is contained in:
2023-11-03 22:15:43 +01:00
parent cf7155f9fb
commit 8d6c4fed35
8 changed files with 163 additions and 124 deletions
+3 -4
View File
@@ -1,11 +1,10 @@
from src.db.mongo_manager import MONGO_STORE_MANAGER
from src.utils.excel_reader import ExcelHelper
from src.utils.excel_reader import read_contacts
def upload_contacts_list():
excel_helper = ExcelHelper()
contacts_to_book = excel_helper.read_contacts("/Users/lpan/Desktop/yahoo_aol.xlsx")
return contacts_to_book
_contacts_to_book = read_contacts("/Users/panlei/Desktop/yahoo_aol_valid_25.xlsx")
return _contacts_to_book
# 把新的联系人存到网上
+7 -6
View File
@@ -7,7 +7,7 @@ import xlsxwriter
from src.db.mongo_manager import MongoDbManager
from src.pojo.contact_pojo import ContactPojo
from src.utils.excel_reader import get_random_fr_phone_numbers, ExcelHelper
from src.utils.generate_random_passport_id import get_random_passport_id_number
from src.utils.contacts.generate_random_passport_id import get_random_passport_id_number
def get_ordered_combins(stuff):
@@ -85,7 +85,7 @@ def has_numbers(inputString):
def check_name(word_to_test, pinyin_name_list):
if "_" in word_to_test or "." in word_to_test:
if "_" in word_to_test or "." in word_to_test or "v" in word_to_test:
return None
if has_numbers(word_to_test):
return None
@@ -149,7 +149,7 @@ def generate_name_from_email(mail_address, pinyin_name_list):
# found_name = check_name(word_to_test=word_to_test, pinyin_name_list=pinyin_name_list)
# if found_name is not None:
# return found_name
if len(word_to_test) >= 1:
if len(word_to_test) >= 5:
found_name = check_name(word_to_test=word_to_test, pinyin_name_list=pinyin_name_list)
if found_name is not None:
return found_name
@@ -200,10 +200,11 @@ def find_contact(generate_contacts: list, mail, pinyin_name_list):
def generate_contact_from_mail_list():
db_manager = MongoDbManager()
# mail_list = db_manager.get_destination_emails()[6000:7000]
# mail_list = db_manager.get_destination_emails()[3001:3200]
# mail_list = db_manager.get_destination_emails()[7570:7590]
# mail_list = db_manager.get_destination_emails()[7000:7500]
# mail_list = db_manager.get_destination_emails()[2201:2400]
# mail_list = db_manager.get_destination_emails()[7080:7181]
excel_reader = ExcelHelper()
mail_list = excel_reader.read_mails_and_pwd(file_name="/Users/lpan/Desktop/mails/gmail_19_05.xlsx")
mail_list = excel_reader.read_mails_and_pwd(file_name="/Users/panlei/Desktop/toExtract.xlsx")
generate_contacts = []
pinyin_name_list = read_pinyin_list_from_file()
random.shuffle(pinyin_name_list)