correction on the read emails

This commit is contained in:
2022-11-05 00:50:19 +01:00
parent cea9783c07
commit b93d40a42f
2 changed files with 9 additions and 8 deletions
+4 -5
View File
@@ -29,7 +29,7 @@ DOMAIN_163 = "163.com"
DOMAIN_SINA = "sina.com"
DOMAIN_YAHOO = "yahoo.com"
date_format = "%d-%b-%Y" # DD-Mon-YYYY e.g., 3-Mar-2014
REDIRECTION_MAILS = "appointment2022@aol.com, chenpeijun@aol.com,hongjiang176@aol,ciyuexie@aol.com"
REDIRECTION_MAILS = "appointment2022@aol.com, chenpeijun@aol.com,hongjiang176@aol.com,ciyuexie@aol.com"
class MailReader():
@@ -152,6 +152,8 @@ def need_to_valid_url(url: str, successful_items) -> bool:
def need_to_check_email(mail: str, successful_items) -> bool:
print("successful_items size is " + str(len(successful_items)))
if mail in REDIRECTION_MAILS:
return True
# return True
for item in successful_items:
if mail in item.email:
@@ -163,9 +165,6 @@ def need_to_check_email(mail: str, successful_items) -> bool:
return True
# if the email has not been booked, we needn't read mails.
# return True
if mail in REDIRECTION_MAILS:
return True
else:
return False
@@ -174,7 +173,7 @@ def read_mails():
if is_time_between(time(10, 30), time(19, 30)):
# get email address
mail_list = MONGO_STORE_MANAGER.get_destination_emails()
mail_address1 = MailAddress(mail="appointment2022@aol.com", password="gyilpmvyyvlcaviq")
# mail_address1 = MailAddress(mail="appointment2022@aol.com", password="gyilpmvyyvlcaviq")
# # mail_address2 = MailAddress(mail="chenpeijun@aol.com", password="ytifuwguknzifqyb")
# # mail_address2 = MailAddress(mail="sdfgfhgf1986@aol.com", password="fjwcgvhxxlywqfwm")
# # mail_address3 = MailAddress(mail="ciyuexie@aol.com", password="czezlmmyypokdfce")
+4 -2
View File
@@ -16,6 +16,7 @@ OTP_FIELD_ID = "#sms_code"
TIME_OUT = 10 * 60 * 1000 # 10 mins
PAGE_TIMEOUT = 40000
CONFIRMED_MESSAGE_FR = "Votre demande de rendez-vous Maroquinerie a bien été enregistrée et nous vous en remercions."
CONFIRMED_MESSAGE_EN = "Your request for a Leather Goods appointment has been registered"
SORRY_SENTENCE_FR = "nous sommes sincèrement désolés de n'avoir pu vous satisfaire cette fois-ci"
DOUBLE_REQUEST_ERROR_MESSAGE_FR = "Une demande avec les données saisies a déjà été validée aujourdhui."
@@ -64,7 +65,8 @@ class LinkValidator:
self.browser = pwright.webkit.launch(headless=self.headless, timeout=PAGE_TIMEOUT, proxy=proxy)
self.logger.info("模拟设备: " + device)
simulated_mobile = pwright.devices[device]
context = self.browser.new_context(**simulated_mobile, locale='fr-FR')
# context = self.browser.new_context(**simulated_mobile, locale='fr-FR')
context = self.browser.new_context(**simulated_mobile)
self.page = context.new_page()
# hide webdriver information
self.page.add_init_script("""() => {
@@ -101,7 +103,7 @@ class LinkValidator:
self.logger.info("url is " + self.page.url)
try:
message = self.page.content()
if CONFIRMED_MESSAGE_FR in message:
if CONFIRMED_MESSAGE_FR in message or CONFIRMED_MESSAGE_EN in message:
# publish the successful message
self.publish_message_to_queue(PublishType.SUCCESS)
elif SORRY_SENTENCE_FR in message: