create method go get not used contacts

This commit is contained in:
Lei PAN
2024-09-02 19:27:21 +02:00
parent 459fa7dd2b
commit a79fff8262
+8 -3
View File
@@ -13,6 +13,7 @@ from src.db.mongo_manager import MONGO_STORE_MANAGER
from src.logs.AppLogging import init_logger
from src.mail.mail_constants import DOMAIN_HOTMAIL, create_imap
from src.pojo.mail.mail_pojo import MailPojo
from src.utils import excel_reader
from src.utils.timeutiles import is_time_between
VALIDATION_URL_SUBJECT_fr = 'Validation de votre demande de rendez-vous'
@@ -251,11 +252,12 @@ def need_to_check_email(mail: str, successful_items) -> bool:
# return False
def read_all_mails():
def read_all_mails(contact_to_book_list=None):
# check time before start checking emails
if is_time_between(time(7, 30), time(19, 30)):
# get email address
contact_to_book_list = MONGO_STORE_MANAGER.get_all_contact_to_book_list()
if contact_to_book_list is None:
contact_to_book_list = MONGO_STORE_MANAGER.get_all_contact_to_book_list()
mail_list = MONGO_STORE_MANAGER.get_destination_emails()
mail_list_to_check = []
for contact in contact_to_book_list:
@@ -303,4 +305,7 @@ def read_all_mails():
# check whether the url has already been clicked
if __name__ == '__main__':
init_logger()
read_all_mails()
contact_to_book_list = excel_reader.read_contacts(
file_name="/Users/panlei/Desktop/contact_list_2024-06-28_4000.xlsx")
read_all_mails(contact_to_book_list=contact_to_book_list)
# read_all_mails()