use source_from field from db

This commit is contained in:
2025-04-08 15:00:26 +02:00
parent 0f157eab37
commit d63a402a6d
4 changed files with 63 additions and 16 deletions
View File
+54 -6
View File
@@ -14,7 +14,7 @@ from src.logs.AppLogging import init_logger
from src.mail.mail_constants import DOMAIN_HOTMAIL, create_imap from src.mail.mail_constants import DOMAIN_HOTMAIL, create_imap
from src.mail.mail_reader import need_to_valid_url from src.mail.mail_reader import need_to_valid_url
from src.pojo.mail.mail_pojo import MailPojo from src.pojo.mail.mail_pojo import MailPojo
from src.utils.excel_reader import ExcelHelper, read_contacts from src.utils.excel_reader import read_contacts
from src.utils.timeutiles import is_time_between from src.utils.timeutiles import is_time_between
VALIDATION_URL_SUBJECT_fr = 'Votre demande de rendez-vous' VALIDATION_URL_SUBJECT_fr = 'Votre demande de rendez-vous'
@@ -283,10 +283,6 @@ def read_all_mails(contact_to_book_list=None):
for mail in mails_messages: for mail in mails_messages:
match = re.search(VALIDATION_URL_REGEX, mail.body) match = re.search(VALIDATION_URL_REGEX, mail.body)
if match: if match:
# url_to_validate = match.group(0)
# if mail.isImapClient:
# url = "https://rendezvousparis.hermes.com/" + url_to_validate.replace("3D", "")
# else:
url = match.group(0) url = match.group(0)
_item, is_need_to = need_to_valid_url(url, mail.to_address, _refreshed_successful_items) _item, is_need_to = need_to_valid_url(url, mail.to_address, _refreshed_successful_items)
if is_need_to: if is_need_to:
@@ -302,6 +298,58 @@ def read_all_mails(contact_to_book_list=None):
if __name__ == '__main__': if __name__ == '__main__':
init_logger() init_logger()
contact_to_book_list = read_contacts( contact_to_book_list = read_contacts(
file_name="/Users/lpan/Desktop/contact_list_2025-01-09_200_aol.xlsx") # file_name="/Users/lpan/Desktop/contact_list_2025-01-16_yahoo_100.xlsx")
# file_name="/Users/lpan/Desktop/contact_list_2025-03-15.xlsx")
# file_name="/Users/lpan/Desktop/contact_list_2025-03-24.xlsx")
# file_name="/Users/lpan/Desktop/contact_list_2025-03-15.xlsx")
# file_name="/Users/lpan/Desktop/contact_list_2025-03-21.xlsx")
# file_name="/Users/lpan/Desktop/contact_list_2025-03-20.xlsx")
# file_name="/Users/lpan/Desktop/contact_list_2025-03-14.xlsx")
# file_name="/Users/lpan/Desktop/contact_aol_200_2025-01-15.xlsx")
# file_name="/Users/lpan/Desktop/contact_list_2025-03-18.xlsx")
# file_name="/Users/lpan/Desktop/contact_list_2025-03-17.xlsx")
# file_name="/Users/lpan/Desktop/contact_list_2025-03-19.xlsx")
# file_name="/Users/lpan/Desktop/contact_list_2025-03-15.xlsx")
# file_name="/Users/lpan/Desktop/contact_list_2025-01-25.xlsx")
# file_name="/Users/lpan/Desktop/contact_list_2025-03-13.xlsx")
# file_name="/Users/lpan/Desktop/contact_list_2025-03-12.xlsx")
# file_name="/Users/lpan/Desktop/contact_list_2025-03-11.xlsx")
# file_name="/Users/lpan/Desktop/contact_list_2025-03-04.xlsx")
# file_name="/Users/lpan/Desktop/contact_list_2025-03-10.xlsx")
# file_name="/Users/lpan/Desktop/contact_list_2025-03-09.xlsx")
# file_name="/Users/lpan/Desktop/contact_list_2025-03-06.xlsx")
# file_name="/Users/lpan/Desktop/contact_list_2025-03-07.xlsx")
# file_name="/Users/lpan/Desktop/extracted_yahoo_contacts_129_24_03_win.xlsx")
# file_name="/Users/lpan/Desktop/contact_list_2025-04-02.xlsx")
# file_name="/Users/lpan/Desktop/extracted_aol_contacts_292_24_03_mac.xlsx")
# file_name="/Users/lpan/Desktop/real_name_contacts_197_24_03.xlsx")x
# file_name="/Users/lpan/Desktop/contact_list_2025-03-29.xlsx")
# file_name="/Users/lpan/Desktop/contact_list_2025-03-31.xlsx")
# file_name="/Users/lpan/Desktop/contact_list_all_21.xlsx")
# file_name="/Users/lpan/Desktop/contact_list_all_10.xlsx")
# file_name="/Users/lpan/Desktop/contact_list_all_14.xlsx")
# file_name="/Users/lpan/Desktop/contact_list_all_19.xlsx")
# file_name="/Users/lpan/Desktop/contact_list_all_22.xlsx")
# file_name="/Users/lpan/Desktop/contact_list_all_2_win.xlsx")
# file_name="/Users/lpan/Desktop/contact_list_2025-03-29.xlsx")
# file_name="/Users/lpan/Desktop/17_18_04_to_test_win.xlsx")
# file_name="/Users/lpan/Desktop/real_name_contacts_200_aol_win.xlsx")
# file_name="/Users/lpan/Desktop/real_name_contacts_200_aol_mac.xlsx")
# file_name="/Users/lpan/Desktop/real_name_contacts_500_27_03_25_fixed_mac.xlsx")
# file_name="/Users/lpan/Desktop/contact_list_2025-03-28_mac.xlsx")
# file_name="/Users/lpan/Desktop/contact_list_2025-03-27_mac.xlsx")
# file_name="/Users/lpan/Desktop/contact_list_2025-03-27_win.xlsx")
# file_name="/Users/lpan/Desktop/contact_list_all_1.xlsx")
# file_name="/Users/lpan/Desktop/contact_list_all_12.xlsx")
# file_name="/Users/lpan/Desktop/contact_list_2025-04-05.xlsx")
# file_name="/Users/lpan/Desktop/real_name_contacts_400_aol_mac.xlsx")
# file_name="/Users/lpan/Desktop/contact_list_2025-04-07.xlsx")
# file_name="/Users/lpan/Desktop/contact_list_2025-04-05.xlsx")
# file_name="/Users/lpan/Desktop/real_name_contacts_100_gmx_ch_05_04_mac.xlsx")
file_name="/Users/lpan/Desktop/real_name_contacts_292_win.xlsx")
# file_name="/Users/lpan/Desktop/real_name_contacts_400_mac_04_04.xlsx")
# file_name="/Users/lpan/Desktop/contact_list_2025-04-01.xlsx")
# file_name="/Users/lpan/Desktop/contact_list_2025-03-08_aol_400.xlsx")
read_all_mails(contact_to_book_list=contact_to_book_list) read_all_mails(contact_to_book_list=contact_to_book_list)
# read_all_mails() # read_all_mails()
+8 -9
View File
@@ -18,7 +18,7 @@ DEFAULT_SERIAL_TO_IGNORE = ["47e7e36b", "bitbrowser"]
def upload_contacts_list(): def upload_contacts_list():
_contacts_to_book = read_contacts(str(Path.home()) + "/Desktop/real_name_contacts_500_27_03_25_fixed_mac.xlsx") _contacts_to_book = read_contacts(str(Path.home()) + "/Desktop/contact_list_2025-04-08.xlsx")
return _contacts_to_book return _contacts_to_book
@@ -100,28 +100,27 @@ def write_new_contacts_to_excel(valid_contacts: list, file_name=str(datetime.dat
def generate_valid_contact_list_for_day(segment_number=1): def generate_valid_contact_list_for_day(segment_number=1):
_collection_name = "2025-03-31" _collection_name = "2025-04-07"
_valid_contact_list = MONGO_STORE_MANAGER.get_all_successful_items_for_one_day(_collection_name) _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() _all_contacts = MONGO_STORE_MANAGER.get_all_contacts_to_book()
_contact_to_save = [] _contact_to_save = []
for _contact in _valid_contact_list: for _contact in _valid_contact_list:
if _contact.mail == "wesley_barton477273@aol.com":
print("found")
# _contact.store = "faubourg" # _contact.store = "faubourg"
_contact.store = "random" _contact.store = "random"
# if _contact.last_name is None or len(_contact.last_name) == 0: # if _contact.last_name is None or len(_contact.last_name) == 0:
for _true_contact in _all_contacts: for _true_contact in _all_contacts:
if _true_contact.mail == _contact.mail: if _true_contact.mail == _contact.mail:
if _contact.mail == "wesley_barton477273@aol.com":
print("found")
_contact.last_name = _true_contact.last_name _contact.last_name = _true_contact.last_name
_contact.phone = _true_contact.phone _contact.phone = _true_contact.phone
_contact.passport = _true_contact.passport _contact.passport = _true_contact.passport
_contact.first_name = _true_contact.first_name _contact.first_name = _true_contact.first_name
_contact.resident_card_number = _true_contact.resident_card_number _contact.resident_card_number = _true_contact.resident_card_number
# if _contact.resident_card_number is None or len(_contact.resident_card_number) == 0: _contact.source_from = _true_contact.source_from
# 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
if _contact.url_validated: if _contact.url_validated:
if _contact.last_name is not None and len(_contact.last_name) > 0: if _contact.last_name is not None and len(_contact.last_name) > 0:
_need_to_save = True _need_to_save = True
@@ -276,4 +275,4 @@ if __name__ == '__main__':
# "/Users/lpan/Desktop/contact_list_2024-11-08.xlsx", # "/Users/lpan/Desktop/contact_list_2024-11-08.xlsx",
# "/Users/lpan/Desktop/contact_list_2024-11-06.xlsx" # "/Users/lpan/Desktop/contact_list_2024-11-06.xlsx"
# ]) # ])
# fix_phone_number_format(str(Path.home()) + "/Desktop/contact_list_2025-03-29_mac.xlsx") # fix_phone_number_format(str(Path.home()) + "/Desktop/gmx_ch_100_2024-06-13.xlsx")
@@ -14,7 +14,7 @@ def has_email(registeredUserPojo: RegisteredUserPojo, reserveResultPojo: Reserve
def generate_list_to_register(): def generate_list_to_register():
_valid_contact_list = [] _valid_contact_list = []
_all_successful_items = MONGO_STORE_MANAGER.get_all_successful_items_for_day() _all_successful_items = MONGO_STORE_MANAGER.get_all_successful_items_for_one_day("2025-04-08")
for _item in _all_successful_items: for _item in _all_successful_items:
if _item.url_validated is not None and _item.url_validated is True: if _item.url_validated is not None and _item.url_validated is True:
_valid_contact_list.append(_item) _valid_contact_list.append(_item)