add yahoo support
This commit is contained in:
@@ -16,9 +16,11 @@ from src.pojo.mail.mail_pojo import MailPojo
|
||||
|
||||
AOL_IMAP_SERVER = "imap.aol.com"
|
||||
IMAP_SERVER_163 = "imap.163.com"
|
||||
YAHOO_IMAP_SERVER = "imap.mail.yahoo.com"
|
||||
CONFIRMATION_SUBJECT_FR = 'Votre rendez-vous est'
|
||||
CONFIRMATION_SUBJECT_EN = 'appointment is confirmed'
|
||||
HERMES_EMAIL = "no-reply@hermes.com"
|
||||
DOMAIN_YAHOO = "yahoo.com"
|
||||
|
||||
DOMAIN_163 = "163.com"
|
||||
date_format = "%d-%b-%Y" # DD-Mon-YYYY e.g., 3-Mar-2014
|
||||
@@ -39,6 +41,8 @@ class MailConfirmationReader():
|
||||
# create an IMAP4 class with SSL
|
||||
if DOMAIN_163 in self.login:
|
||||
imap = imaplib.IMAP4_SSL(IMAP_SERVER_163)
|
||||
elif DOMAIN_YAHOO in self.login:
|
||||
imap = imaplib.IMAP4_SSL(YAHOO_IMAP_SERVER)
|
||||
else:
|
||||
imap = imaplib.IMAP4_SSL(AOL_IMAP_SERVER)
|
||||
# authenticate
|
||||
@@ -109,27 +113,6 @@ def clean(text):
|
||||
return "".join(c if c.isalnum() else "_" for c in text)
|
||||
|
||||
|
||||
def need_to_valid_url(url: str, successful_items) -> bool:
|
||||
print("url is :" + url)
|
||||
parts = url.split('/')
|
||||
id = parts[5]
|
||||
if len(id) == 6:
|
||||
for item in successful_items:
|
||||
# if item.url_validated is not None:
|
||||
# print("id:{}, status:{} ".format(id, str(item.url_validated)))
|
||||
if item.id == id:
|
||||
if item.url_validated is not None:
|
||||
return not item.url_validated
|
||||
else:
|
||||
# if url_validated is None
|
||||
return True
|
||||
# return True by default
|
||||
return False
|
||||
else:
|
||||
print("id not valid:{}".format(id))
|
||||
return False
|
||||
|
||||
|
||||
def accept_appointment_found(accepted_result_list: list):
|
||||
mailer = Mailer()
|
||||
for reserve in accepted_result_list:
|
||||
|
||||
Reference in New Issue
Block a user