change interval to check emails
This commit is contained in:
+1
-1
@@ -5,7 +5,7 @@ from src.mail.mail_reader import read_mails
|
||||
|
||||
|
||||
def start_check_mail_job(sched):
|
||||
sched.add_job(read_mails, 'cron', day_of_week='mon-sat', minute='*/10', jitter=240, timezone='Europe/Paris',
|
||||
sched.add_job(read_mails, 'cron', day_of_week='mon-sat', minute='*/15', jitter=240, timezone='Europe/Paris',
|
||||
max_instances=1)
|
||||
# sched.add_job(read_mails, 'cron', day_of_week='mon-sat', hour='11',
|
||||
# minute='30',
|
||||
|
||||
@@ -145,7 +145,7 @@ def need_to_valid_url(url: str, successful_items) -> bool:
|
||||
|
||||
|
||||
def need_to_check_email(mail: str, successful_items) -> bool:
|
||||
return True
|
||||
# return True
|
||||
print("successful_items size is " + str(len(successful_items)))
|
||||
for item in successful_items:
|
||||
if mail in item.email:
|
||||
@@ -156,6 +156,7 @@ def need_to_check_email(mail: str, successful_items) -> bool:
|
||||
# if url-validated is none, need to check email
|
||||
return True
|
||||
# if the email has not been booked, we needn't read mails.
|
||||
# return True
|
||||
if mail in REDIRECTION_MAILS:
|
||||
return True
|
||||
else:
|
||||
@@ -182,7 +183,7 @@ def read_mails():
|
||||
mail_reader = MailReader(mail.mail, mail.password)
|
||||
executor.submit(mail_reader.read_emails, mails_messages)
|
||||
|
||||
with ThreadPoolExecutor(max_workers=8) as executor:
|
||||
with ThreadPoolExecutor(max_workers=10) as executor:
|
||||
for mail in mails_messages:
|
||||
match = re.search(VALIDATION_URL_REGEX, mail.body)
|
||||
if match:
|
||||
@@ -190,7 +191,7 @@ def read_mails():
|
||||
if need_to_valid_url(url, successful_items):
|
||||
url_validator = LinkValidator(url)
|
||||
print("need to validate url: " + url)
|
||||
executor.submit(url_validator.start_page, params.get_proxy(ProxyType.RESIDENTIAL), False)
|
||||
executor.submit(url_validator.start_page, params.get_proxy(ProxyType.RESIDENTIAL), True)
|
||||
else:
|
||||
print("do not need to click url --> {}".format(mail.mail_address))
|
||||
|
||||
|
||||
+2
-2
@@ -13,9 +13,9 @@ PROXY_PASSWORD = "94sY7zwBG13i"
|
||||
BRIGHT_DATA_PROXY_SERVER = "http://zproxy.lum-superproxy.io:22225"
|
||||
OXYLABS_PROXY_SERVER = "pr.oxylabs.io:7777"
|
||||
OXYLABS_DATA_PROXY_USERNAME = "customer-appointment-cc-FR"
|
||||
BRIGHT_DATA_PROXY_USERNAME = "lum-customer-c_daabba94-zone-residential-country-fr"
|
||||
BRIGHT_DATA_PROXY_USERNAME = "lum-customer-c_daabba94-zone-zone1-country-fr"
|
||||
BRIGHT_DATA_MOBILE_PROXY_USERNAME = "lum-customer-c_daabba94-zone-mobile-country-fr-mobile"
|
||||
BRIGHT_DATA_PROXY_PASSWORD = "9dwmh54u3bbh"
|
||||
BRIGHT_DATA_PROXY_PASSWORD = "fek66ugso76z"
|
||||
OXYLABS_DATA_PROXY_PASSWORD = "Rdv@20222021"
|
||||
BRIGHT_DATA_MOBILE_PROXY_PASSWORD = "fk5f7c2z2c19"
|
||||
PROXY_NAME_PREFIX_RES = "panleicim-res-fr-"
|
||||
|
||||
Reference in New Issue
Block a user