Merge branch 'master' of bitbucket.org:panleicim/appointment_tool
This commit is contained in:
@@ -13,6 +13,7 @@ from src.db.mongo_manager import MONGO_STORE_MANAGER
|
|||||||
from src.logs.AppLogging import init_logger
|
from src.logs.AppLogging import init_logger
|
||||||
from src.mail.mail_constants import DOMAIN_HOTMAIL, create_imap
|
from src.mail.mail_constants import DOMAIN_HOTMAIL, create_imap
|
||||||
from src.pojo.mail.mail_pojo import MailPojo
|
from src.pojo.mail.mail_pojo import MailPojo
|
||||||
|
from src.utils import excel_reader
|
||||||
from src.utils.timeutiles import is_time_between
|
from src.utils.timeutiles import is_time_between
|
||||||
|
|
||||||
VALIDATION_URL_SUBJECT_fr = 'Validation de votre demande de rendez-vous'
|
VALIDATION_URL_SUBJECT_fr = 'Validation de votre demande de rendez-vous'
|
||||||
@@ -253,10 +254,11 @@ def need_to_check_email(mail: str, successful_items) -> bool:
|
|||||||
# return False
|
# return False
|
||||||
|
|
||||||
|
|
||||||
def read_all_mails():
|
def read_all_mails(contact_to_book_list=None):
|
||||||
# check time before start checking emails
|
# check time before start checking emails
|
||||||
if is_time_between(time(7, 30), time(19, 30)):
|
if is_time_between(time(7, 30), time(19, 30)):
|
||||||
# get email address
|
# get email address
|
||||||
|
if contact_to_book_list is None:
|
||||||
contact_to_book_list = MONGO_STORE_MANAGER.get_all_contact_to_book_list()
|
contact_to_book_list = MONGO_STORE_MANAGER.get_all_contact_to_book_list()
|
||||||
mail_list = MONGO_STORE_MANAGER.get_destination_emails()
|
mail_list = MONGO_STORE_MANAGER.get_destination_emails()
|
||||||
mail_list_to_check = []
|
mail_list_to_check = []
|
||||||
@@ -305,4 +307,7 @@ def read_all_mails():
|
|||||||
# check whether the url has already been clicked
|
# check whether the url has already been clicked
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
init_logger()
|
init_logger()
|
||||||
|
# contact_to_book_list = excel_reader.read_contacts(
|
||||||
|
# file_name="/Users/panlei/Desktop/contact_list_2024-06-28_4000.xlsx")
|
||||||
|
# read_all_mails(contact_to_book_list=contact_to_book_list)
|
||||||
read_all_mails()
|
read_all_mails()
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
import datetime
|
import datetime
|
||||||
import random
|
import random
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
import xlsxwriter
|
import xlsxwriter
|
||||||
from src.person_name.cython_extract_methods import filter_already_validated_contacts, read_pinyin_list_from_file
|
# from src.person_name.cython_extract_methods import filter_already_validated_contacts, read_pinyin_list_from_file
|
||||||
|
|
||||||
from src.db.mongo_manager import MONGO_STORE_MANAGER
|
from src.db.mongo_manager import MONGO_STORE_MANAGER
|
||||||
from src.pojo.contact_pojo import ContactPojo
|
from src.pojo.contact_pojo import ContactPojo
|
||||||
@@ -13,7 +14,7 @@ DEFAULT_SERIAL = "47e7e36b"
|
|||||||
|
|
||||||
|
|
||||||
def upload_contacts_list():
|
def upload_contacts_list():
|
||||||
_contacts_to_book = read_contacts("/Users/lpan/Desktop/contact_list_2024-09-28.xlsx")
|
_contacts_to_book = read_contacts(str(Path.home()) + "/Desktop/contact_list_2024-10-03.xlsx")
|
||||||
return _contacts_to_book
|
return _contacts_to_book
|
||||||
|
|
||||||
|
|
||||||
@@ -203,14 +204,14 @@ if __name__ == '__main__':
|
|||||||
# contacts_to_book = upload_contacts_list()
|
# contacts_to_book = upload_contacts_list()
|
||||||
# MONGO_STORE_MANAGER.upload_contact_list(contacts_to_book)
|
# MONGO_STORE_MANAGER.upload_contact_list(contacts_to_book)
|
||||||
# print("start at {}".format(datetime.datetime.now()))
|
# print("start at {}".format(datetime.datetime.now()))
|
||||||
generate_valid_contact_list_for_day(segment_number=2)
|
# generate_valid_contact_list_for_day(segment_number=2)
|
||||||
# generate_contact_from_mail_list("/Users/lpan/Downloads/邮箱及密码.xlsx")
|
# generate_contact_from_mail_list("/Users/lpan/Downloads/邮箱及密码.xlsx")
|
||||||
# print("end at {}".format(datetime.datetime.now()))
|
# print("end at {}".format(datetime.datetime.now()))
|
||||||
# update_contact_list_not_received_mail()
|
# update_contact_list_not_received_mail()
|
||||||
# generate_valid_contact_list_for_day(segment_number=2)
|
# generate_valid_contact_list_for_day(segment_number=2)
|
||||||
# get_old_validated_contact_list()
|
# get_old_validated_contact_list()
|
||||||
# print("end at {}".format(datetime.datetime.now()))
|
# print("end at {}".format(datetime.datetime.now()))
|
||||||
# generate_all_contact_list()
|
generate_all_contact_list()
|
||||||
# merge_contact_list_files(
|
# merge_contact_list_files(
|
||||||
# ["/Users/lpan/Desktop/contact_list_all_old_not_used_contact.xlsx",
|
# ["/Users/lpan/Desktop/contact_list_all_old_not_used_contact.xlsx",
|
||||||
# "/Users/lpan/Desktop/contact_list_2024-06-26.xlsx"])
|
# "/Users/lpan/Desktop/contact_list_2024-06-26.xlsx"])
|
||||||
|
|||||||
@@ -49,7 +49,8 @@ class ContactPojo:
|
|||||||
u'store': self.store,
|
u'store': self.store,
|
||||||
u'ip_country': self.ip_country,
|
u'ip_country': self.ip_country,
|
||||||
u'current_ip': self.current_ip,
|
u'current_ip': self.current_ip,
|
||||||
u'ua': self.ua
|
u'ua': self.ua,
|
||||||
|
u'serial': self.serial
|
||||||
}
|
}
|
||||||
return dest
|
return dest
|
||||||
|
|
||||||
@@ -80,5 +81,8 @@ class ContactPojo:
|
|||||||
result.ip_country = ip_country
|
result.ip_country = ip_country
|
||||||
if source.get('current_ip'):
|
if source.get('current_ip'):
|
||||||
result.current_ip = source['current_ip']
|
result.current_ip = source['current_ip']
|
||||||
|
if source.get('serial'):
|
||||||
|
serial = source['serial']
|
||||||
|
result.serial = serial
|
||||||
result.ua = ua
|
result.ua = ua
|
||||||
return result
|
return result
|
||||||
|
|||||||
@@ -58,6 +58,9 @@ def read_contacts(file_name) -> list:
|
|||||||
first_name=first_name,
|
first_name=first_name,
|
||||||
passport_number=contact_dict['passport'],
|
passport_number=contact_dict['passport'],
|
||||||
mail=contact_dict['email'], store=store)
|
mail=contact_dict['email'], store=store)
|
||||||
|
if contact_dict.get('serial') is not None:
|
||||||
|
serial = contact_dict['serial']
|
||||||
|
contact.serial = serial
|
||||||
contact.ip_country = ip_country
|
contact.ip_country = ip_country
|
||||||
contact.ua = ua
|
contact.ua = ua
|
||||||
contact_list.append(contact)
|
contact_list.append(contact)
|
||||||
|
|||||||
Reference in New Issue
Block a user