add method to check all contacts' mails
This commit is contained in:
@@ -15,6 +15,7 @@ MONGO_DB_URL = "mongo.lpaconsulting.fr"
|
||||
CAPTCHA_ERROR_COLLECTION_PREFIX = "CAPTCHA_ERROR_"
|
||||
BLACK_LIST = "BLACK_LIST"
|
||||
ACCEPTED_APPOINTMENT_LIST = "ACCEPTED_APPOINTMENT_LIST"
|
||||
CONTACT_LIST_TO_BOOK = "CONTACT_LIST_TO_BOOK"
|
||||
EMAIL_LIST = "EMAIL_LIST"
|
||||
DESTINATION_EMAIL_LIST = "DESTINATION_EMAIL_LIST"
|
||||
LINKS_TO_VALIDATE = "LINKS_TO_VALIDATE"
|
||||
@@ -71,6 +72,15 @@ class MongoDbManager:
|
||||
except Exception as Error:
|
||||
self.logger.info(Error)
|
||||
|
||||
def upload_contact_list(self, contact_list: list):
|
||||
|
||||
try:
|
||||
collection_to_use = self.db[CONTACT_LIST_TO_BOOK]
|
||||
for contact in contact_list:
|
||||
collection_to_use.insert_one(contact.to_firestore_dict())
|
||||
except Exception as Error:
|
||||
self.logger.info(Error)
|
||||
|
||||
def get_all_accepted_appointments(self) -> list:
|
||||
collection_name = ACCEPTED_APPOINTMENT_LIST
|
||||
appointment_list_contacts = []
|
||||
@@ -190,6 +200,13 @@ class MongoDbManager:
|
||||
result_list.append(ReserveResultPojo.from_firestore_dict(document))
|
||||
return result_list
|
||||
|
||||
def get_all_contact_to_book_list(self) -> list:
|
||||
result_list = []
|
||||
cursor = self.db[CONTACT_LIST_TO_BOOK]
|
||||
for document in cursor.find():
|
||||
result_list.append(ContactPojo.from_firestore_dict(document))
|
||||
return result_list
|
||||
|
||||
def get_accepted_items_for_one_day(self, day_in_str: str) -> list:
|
||||
collection_name = day_in_str
|
||||
result_list = []
|
||||
|
||||
@@ -12,6 +12,7 @@ from src.mail.mail_constants import DOMAIN_163, DOMAIN_YAHOO, DOMAIN_SINA, IMAP_
|
||||
from src.pojo.mail.mail_pojo import MailPojo
|
||||
|
||||
REFUSED_SUBJECT_EN = 'Appointment follow up'
|
||||
REFUSED_SUBJECT_FR = 'Demande de rendez-vous'
|
||||
HERMES_EMAIL = "no-reply@hermes.com"
|
||||
|
||||
date_format = "%d-%b-%Y" # DD-Mon-YYYY e.g., 3-Mar-2014
|
||||
@@ -51,6 +52,7 @@ class MailRefusedReader():
|
||||
mail_list = []
|
||||
print("read mails from {}".format(self.login))
|
||||
mail_list.extend(self._get_messages_from_folder(imap, REFUSED_SUBJECT_EN))
|
||||
mail_list.extend(self._get_messages_from_folder(imap, REFUSED_SUBJECT_FR))
|
||||
# close the connection and logout
|
||||
imap.close()
|
||||
imap.logout()
|
||||
|
||||
Reference in New Issue
Block a user