optimization on email reader

This commit is contained in:
2022-08-09 23:01:10 +02:00
parent 138b4a087b
commit f780834d88
4 changed files with 4 additions and 12 deletions
-4
View File
@@ -5,10 +5,6 @@ from src.mail.mail_reader import read_mails
def start_check_mail_job(sched):
# sched.add_job(start_book_appointment, 'cron', day_of_week='mon-sat', hour='10',
# minute='30',
# misfire_grace_time=10,
# second='0', timezone='Europe/Paris', max_instances=1)
sched.add_job(read_mails, 'cron', day_of_week='mon-sat', hour='11',
minute='30',
misfire_grace_time=10,
-4
View File
@@ -14,10 +14,6 @@ def start_book_appointment():
def start_check_results_job(sched):
# sched.add_job(start_book_appointment, 'cron', day_of_week='mon-sat', hour='10',
# minute='30',
# misfire_grace_time=10,
# second='0', timezone='Europe/Paris', max_instances=1)
sched.add_job(check_results, 'cron', day_of_week='mon-sat', hour='20',
minute='55',
misfire_grace_time=10,
+3 -3
View File
@@ -121,8 +121,8 @@ def need_to_valid_url(url: str, successful_items) -> bool:
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.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
@@ -146,9 +146,9 @@ def read_mails():
# mail_address4 = MailAddress(mail="hongjiang176@aol.com", password="ftzpscgzvwneelmn")
# mail_list = [mail_address3, mail_address2, mail_address1, mail_address4]
# mail_list = [mail_address1]
successful_items = MONGO_STORE_MANAGER.get_all_successful_items_for_day()
for mail in mail_list:
mail_reader = MailReader(mail.mail, mail.password)
successful_items = MONGO_STORE_MANAGER.get_all_successful_items_for_day()
mail_info_list = mail_reader.read_emails()
with ThreadPoolExecutor(max_workers=10) as executor:
for mail in mail_info_list:
+1 -1
View File
@@ -204,5 +204,5 @@ if __name__ == '__main__':
save_mails_to_db()
# for mail in excel_reader.read_mails_and_pwd():
# MONGO_STORE_MANAGER.insert_email(mail)
# for i in range(1,20):
# for i in range(1,2):
# print(get_random_phone_numbers())