correction on the read emails
This commit is contained in:
@@ -29,7 +29,7 @@ DOMAIN_163 = "163.com"
|
|||||||
DOMAIN_SINA = "sina.com"
|
DOMAIN_SINA = "sina.com"
|
||||||
DOMAIN_YAHOO = "yahoo.com"
|
DOMAIN_YAHOO = "yahoo.com"
|
||||||
date_format = "%d-%b-%Y" # DD-Mon-YYYY e.g., 3-Mar-2014
|
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():
|
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:
|
def need_to_check_email(mail: str, successful_items) -> bool:
|
||||||
print("successful_items size is " + str(len(successful_items)))
|
print("successful_items size is " + str(len(successful_items)))
|
||||||
|
if mail in REDIRECTION_MAILS:
|
||||||
|
return True
|
||||||
# return True
|
# return True
|
||||||
for item in successful_items:
|
for item in successful_items:
|
||||||
if mail in item.email:
|
if mail in item.email:
|
||||||
@@ -163,10 +165,7 @@ def need_to_check_email(mail: str, successful_items) -> bool:
|
|||||||
return True
|
return True
|
||||||
# if the email has not been booked, we needn't read mails.
|
# if the email has not been booked, we needn't read mails.
|
||||||
# return True
|
# return True
|
||||||
if mail in REDIRECTION_MAILS:
|
return False
|
||||||
return True
|
|
||||||
else:
|
|
||||||
return False
|
|
||||||
|
|
||||||
|
|
||||||
def read_mails():
|
def read_mails():
|
||||||
@@ -174,7 +173,7 @@ def read_mails():
|
|||||||
if is_time_between(time(10, 30), time(19, 30)):
|
if is_time_between(time(10, 30), time(19, 30)):
|
||||||
# get email address
|
# get email address
|
||||||
mail_list = MONGO_STORE_MANAGER.get_destination_emails()
|
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="chenpeijun@aol.com", password="ytifuwguknzifqyb")
|
||||||
# # mail_address2 = MailAddress(mail="sdfgfhgf1986@aol.com", password="fjwcgvhxxlywqfwm")
|
# # mail_address2 = MailAddress(mail="sdfgfhgf1986@aol.com", password="fjwcgvhxxlywqfwm")
|
||||||
# # mail_address3 = MailAddress(mail="ciyuexie@aol.com", password="czezlmmyypokdfce")
|
# # mail_address3 = MailAddress(mail="ciyuexie@aol.com", password="czezlmmyypokdfce")
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ OTP_FIELD_ID = "#sms_code"
|
|||||||
TIME_OUT = 10 * 60 * 1000 # 10 mins
|
TIME_OUT = 10 * 60 * 1000 # 10 mins
|
||||||
PAGE_TIMEOUT = 40000
|
PAGE_TIMEOUT = 40000
|
||||||
CONFIRMED_MESSAGE_FR = "Votre demande de rendez-vous Maroquinerie a bien été enregistrée et nous vous en remercions."
|
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"
|
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 aujourd’hui."
|
DOUBLE_REQUEST_ERROR_MESSAGE_FR = "Une demande avec les données saisies a déjà été validée aujourd’hui."
|
||||||
|
|
||||||
@@ -64,7 +65,8 @@ class LinkValidator:
|
|||||||
self.browser = pwright.webkit.launch(headless=self.headless, timeout=PAGE_TIMEOUT, proxy=proxy)
|
self.browser = pwright.webkit.launch(headless=self.headless, timeout=PAGE_TIMEOUT, proxy=proxy)
|
||||||
self.logger.info("模拟设备: " + device)
|
self.logger.info("模拟设备: " + device)
|
||||||
simulated_mobile = pwright.devices[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()
|
self.page = context.new_page()
|
||||||
# hide webdriver information
|
# hide webdriver information
|
||||||
self.page.add_init_script("""() => {
|
self.page.add_init_script("""() => {
|
||||||
@@ -101,7 +103,7 @@ class LinkValidator:
|
|||||||
self.logger.info("url is " + self.page.url)
|
self.logger.info("url is " + self.page.url)
|
||||||
try:
|
try:
|
||||||
message = self.page.content()
|
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
|
# publish the successful message
|
||||||
self.publish_message_to_queue(PublishType.SUCCESS)
|
self.publish_message_to_queue(PublishType.SUCCESS)
|
||||||
elif SORRY_SENTENCE_FR in message:
|
elif SORRY_SENTENCE_FR in message:
|
||||||
|
|||||||
Reference in New Issue
Block a user