add method to extract contact list with serial
This commit is contained in:
@@ -181,10 +181,7 @@ class MailReader():
|
||||
return mail_messages
|
||||
|
||||
|
||||
def need_to_valid_url(url: str, successful_items):
|
||||
# return True
|
||||
# if len(successful_items) == 0:
|
||||
# return False
|
||||
def need_to_valid_url(url: str, email, successful_items):
|
||||
print("url is :" + url)
|
||||
parts = url.split('/')
|
||||
id = parts[5]
|
||||
@@ -198,6 +195,9 @@ def need_to_valid_url(url: str, successful_items):
|
||||
if item.url_validated is not None:
|
||||
return item, not item.url_validated
|
||||
return item, True
|
||||
for item in successful_items:
|
||||
if item.mail == email:
|
||||
return item, True
|
||||
return None, True
|
||||
else:
|
||||
print("id not valid:{}".format(id))
|
||||
@@ -262,7 +262,7 @@ def read_mails():
|
||||
match = re.search(VALIDATION_URL_REGEX, mail.body)
|
||||
if match:
|
||||
url = match.group(0)
|
||||
_item, is_need_to = need_to_valid_url(url, _refreshed_successful_items)
|
||||
_item, is_need_to = need_to_valid_url(url, mail.to_address, _refreshed_successful_items)
|
||||
if is_need_to:
|
||||
MONGO_STORE_MANAGER.save_links_to_validate(url, mail.to_address, _all_contact_list, _item,
|
||||
contact_serial_map_list)
|
||||
|
||||
@@ -293,7 +293,7 @@ def read_all_mails(contact_to_book_list=None):
|
||||
# url = "https://rendezvousparis.hermes.com/" + url_to_validate.replace("3D", "")
|
||||
# else:
|
||||
url = match.group(0)
|
||||
_item, is_need_to = need_to_valid_url(url, _refreshed_successful_items)
|
||||
_item, is_need_to = need_to_valid_url(url, mail.to_address, _refreshed_successful_items)
|
||||
if is_need_to:
|
||||
print("need to validate url: " + url)
|
||||
MONGO_STORE_MANAGER.save_links_to_validate(url, mail.to_address,
|
||||
|
||||
Reference in New Issue
Block a user