add extract_name_with_pinyinlist.py
This commit is contained in:
@@ -93,7 +93,7 @@ def write_new_contacts_to_excel(valid_contacts: list):
|
|||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
db_manager = MongoDbManager()
|
db_manager = MongoDbManager()
|
||||||
mail_list = db_manager.get_destination_emails()[1001:1200]
|
mail_list = db_manager.get_destination_emails()[1201:1500]
|
||||||
# mail_list = db_manager.get_destination_emails()[50:200]
|
# mail_list = db_manager.get_destination_emails()[50:200]
|
||||||
generate_contacts = []
|
generate_contacts = []
|
||||||
pinyin_name_list = read_pinyin_list_from_file()
|
pinyin_name_list = read_pinyin_list_from_file()
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ class ExcelHelper:
|
|||||||
print(user_agent_list)
|
print(user_agent_list)
|
||||||
|
|
||||||
def read_contacts(self, file_name=CONTACT_LIST_FILE) -> list:
|
def read_contacts(self, file_name=CONTACT_LIST_FILE) -> list:
|
||||||
|
print("read file " + file_name)
|
||||||
contact_list_in_json = pandas.read_excel(file_name).to_json(orient='records')
|
contact_list_in_json = pandas.read_excel(file_name).to_json(orient='records')
|
||||||
contact_dict_list = json.loads(contact_list_in_json)
|
contact_dict_list = json.loads(contact_list_in_json)
|
||||||
contact_list = []
|
contact_list = []
|
||||||
@@ -60,8 +61,8 @@ class ExcelHelper:
|
|||||||
contact_list.append(contact)
|
contact_list.append(contact)
|
||||||
return contact_list
|
return contact_list
|
||||||
|
|
||||||
def check_contact_list(self):
|
def check_contact_list(self, file_name=CONTACT_LIST_FILE):
|
||||||
contact_list = self.read_contacts()
|
contact_list = self.read_contacts(file_name)
|
||||||
for contact in contact_list:
|
for contact in contact_list:
|
||||||
if contact.first_name is None or len(contact.first_name) == 0:
|
if contact.first_name is None or len(contact.first_name) == 0:
|
||||||
print("error in firstName for " + contact.mail)
|
print("error in firstName for " + contact.mail)
|
||||||
@@ -227,12 +228,12 @@ def save_mails_to_db():
|
|||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
# excel_reader = ExcelHelper()
|
# excel_reader = ExcelHelper()
|
||||||
# contacts = excel_reader.read_names("/Users/lpan/Downloads/10_rambler_ru_23_03_2023.xlsx")
|
# contacts = excel_reader.read_names("/Users/lpan/Downloads/gmail_10.xlsx")
|
||||||
# print(contacts)
|
# print(contacts)
|
||||||
# write_new_contacts_to_excel(valid_contacts=contacts)
|
# write_new_contacts_to_excel(valid_contacts=contacts)
|
||||||
# excel_reader = ExcelHelper()
|
excel_reader = ExcelHelper()
|
||||||
# excel_reader.check_contact_list()
|
excel_reader.check_contact_list("/Users/lpan/Desktop/contact_email_valid.xlsx")
|
||||||
save_mails_to_db()
|
# save_mails_to_db()
|
||||||
# for mail in excel_reader.read_mails_and_pwd():
|
# for mail in excel_reader.read_mails_and_pwd():
|
||||||
# MONGO_STORE_MANAGER.insert_email(mail)
|
# MONGO_STORE_MANAGER.insert_email(mail)
|
||||||
# for i in range(1, 64):
|
# for i in range(1, 64):
|
||||||
|
|||||||
Reference in New Issue
Block a user