Merge branch 'master' of bitbucket.org:panleicim/appointment_tool
This commit is contained in:
@@ -14,7 +14,6 @@ from src.notification.SignalSender import SignalSender
|
||||
from src.notification.mailer import Mailer
|
||||
from src.pojo.ResultEnum import ResultEnum
|
||||
from src.pojo.mail.mail_pojo import MailPojo, MailAddress
|
||||
from src.utils.excel_reader import ExcelHelper
|
||||
|
||||
CONFIRMATION_SUBJECT_FR = 'rendez-vous est'
|
||||
CONFIRMATION_SUBJECT_EN = 'confirmed'
|
||||
@@ -154,7 +153,7 @@ def accept_appointment_found(accepted_result_list: list):
|
||||
for user in _all_register_account:
|
||||
if user.mail == result.email:
|
||||
result.account_password = user.password
|
||||
mailer.send_email(result, to_all=False)
|
||||
mailer.send_email(result, to_all=True)
|
||||
MONGO_STORE_MANAGER.update_reserve_result(reserve.id, ResultEnum.ACCEPTED, reserve.message)
|
||||
# sginal.send_result(result)
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@ DOMAN_BTVM_NE_JP = "btvm.ne.jp"
|
||||
DOMAN_AURORA_DTI_NE_JP = "aurora.dti.ne.jp"
|
||||
DOMAN_GMAIL = "gmail.com"
|
||||
DOMAIN_GMX = "gmx.com"
|
||||
DOMAIN_GMX_NET = "gmx.net"
|
||||
DOMAIN_GMX_FR = "gmx.fr"
|
||||
DOMAIN_GMX_US = "gmx.us"
|
||||
DOMAIN_GMX_CH = "gmx.ch"
|
||||
@@ -100,7 +101,7 @@ def create_imap(login: str):
|
||||
imap = imaplib.IMAP4(MARS_DTI_NE_JP_SERVER, port=143)
|
||||
elif DOMAIN_NAVER in login:
|
||||
imap = imaplib.IMAP4_SSL(NAVER_SERVER, port=993)
|
||||
elif DOMAIN_GMX_DE in login:
|
||||
elif DOMAIN_GMX_DE in login or DOMAIN_GMX_NET in login:
|
||||
imap = imaplib.IMAP4_SSL(SERVER_GMX_NET, port=993)
|
||||
elif DOMAIN_INBOX_LV in login:
|
||||
imap = imaplib.IMAP4_SSL(INBOX_LV, port=993)
|
||||
|
||||
@@ -8,7 +8,7 @@ from src.utils.excel_reader import read_contacts, fr_phone_number_prefix, get_ra
|
||||
|
||||
|
||||
def upload_contacts_list():
|
||||
_contacts_to_book = read_contacts("/Users/lpan/Desktop/contact_list_2024-04-15.xlsx")
|
||||
_contacts_to_book = read_contacts("/Users/lpan/Desktop/contact_list_2024-04-18.xlsx")
|
||||
return _contacts_to_book
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ def fix_phone_number_format(file_path):
|
||||
if _contact.phone[0:2] not in fr_phone_number_prefix:
|
||||
print(_contact)
|
||||
_contact.phone = get_random_fr_phone_numbers()
|
||||
write_new_contacts_to_excel(_contact_list, file_name="09_04_to_test")
|
||||
write_new_contacts_to_excel(_contact_list, file_name="22_04_to_test")
|
||||
|
||||
|
||||
def write_new_contacts_to_excel(valid_contacts: list, file_name=str(datetime.date.today())):
|
||||
@@ -63,16 +63,31 @@ def generate_valid_contact_list_for_day(sement_number = 1):
|
||||
|
||||
if _contact.url_validated:
|
||||
if _contact.last_name is not None and len(_contact.last_name) > 0:
|
||||
_need_to_save = True
|
||||
# remove the duplicated items
|
||||
for _added_item in _contact_to_save:
|
||||
if (_added_item.mail == _contact.mail
|
||||
and _added_item.phone == _contact.phone
|
||||
and _added_item.passport == _contact.passport
|
||||
and _added_item.last_name == _contact.last_name
|
||||
and _added_item.first_name == _contact.first_name):
|
||||
_need_to_save = False
|
||||
if _need_to_save:
|
||||
_contact_to_save.append(_contact)
|
||||
write_new_contacts_to_excel(_contact_to_save)
|
||||
|
||||
# if _contact.mail == "talasapdne@gmx.de":
|
||||
# print(_contact.__hash__())
|
||||
# if _contact not in _contact_to_save:
|
||||
# _contact_to_save.add(_contact)
|
||||
_contact_to_save_list = _contact_to_save
|
||||
write_new_contacts_to_excel(_contact_to_save_list)
|
||||
for i in range(0, sement_number):
|
||||
_step = int(len(_contact_to_save) / sement_number)
|
||||
_sublist = _contact_to_save[i * _step:_step * (i + 1)]
|
||||
_step = int(len(_contact_to_save_list) / sement_number)
|
||||
_sublist = _contact_to_save_list[i * _step:_step * (i + 1)]
|
||||
_file_name = str(datetime.date.today()) + "_" + str(i + 1)
|
||||
write_new_contacts_to_excel(_sublist, file_name=_file_name)
|
||||
|
||||
|
||||
|
||||
def merge_contact_list_files(file_list: list, final_file_name="merged_contact_list"):
|
||||
_all_contact_list = []
|
||||
for file in file_list:
|
||||
@@ -97,11 +112,14 @@ def generate_all_contact_list():
|
||||
if __name__ == '__main__':
|
||||
# contacts_to_book = upload_contacts_list()
|
||||
# MONGO_STORE_MANAGER.upload_contact_list(contacts_to_book)
|
||||
generate_valid_contact_list_for_day(sement_number=3)
|
||||
generate_valid_contact_list_for_day(sement_number=2)
|
||||
# generate_all_contact_list()
|
||||
# merge_contact_list_files(
|
||||
# ["/Users/lpan/Desktop/contact_list_2024-04-10.xlsx",
|
||||
# "/Users/lpan/Desktop/contact_list_2024-04-09.xlsx",
|
||||
# "/Users/lpan/Desktop/contact_list_2024-04-06.xlsx",
|
||||
# "/Users/lpan/Desktop/contact_list_2024-04-04.xlsx"])
|
||||
# fix_phone_number_format("/Users/lpan/Desktop/09_04_to_test.xlsx")
|
||||
# ["/Users/lpan/Desktop/20_04_to_test_1.xlsx",
|
||||
# "/Users/lpan/Desktop/19_04_to_test.xlsx",
|
||||
# "/Users/lpan/Desktop/17_18_04_to_test.xlsx",
|
||||
# "/Users/lpan/Desktop/09_04_to_test.xlsx",
|
||||
# "/Users/lpan/Desktop/31_03_to_test.xlsx",
|
||||
# "/Users/lpan/Desktop/12_04_to_test.xlsx",
|
||||
# "/Users/lpan/Desktop/16_04_to_test.xlsx"])
|
||||
# fix_phone_number_format("/Users/lpan/Desktop/22_04_to_test.xlsx")
|
||||
|
||||
@@ -39,6 +39,9 @@ class ReserveResultPojo:
|
||||
validated_at = None
|
||||
ip_address = None
|
||||
|
||||
def __hash__(self):
|
||||
return hash("{}_{}_{}_{}_{}".format(self.mail, self.first_name, self.last_name, self.phone, self.passport))
|
||||
|
||||
@staticmethod
|
||||
def from_firestore_dict(source):
|
||||
publish_type = PublishType.ERROR
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
TAGS_JS_FILE_URL = "https://d.digital.hermes/tags.js"
|
||||
def download_tags_file(url):
|
||||
import wget
|
||||
|
||||
def download_tags_file(url):
|
||||
_file_name = wget.download(url)
|
||||
print(_file_name)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user