Merge branch 'master' of bitbucket.org:panleicim/appointment_tool
This commit is contained in:
@@ -18,7 +18,9 @@ DOMAIN_GMX_NET = "gmx.net"
|
||||
DOMAIN_GMX_AT = "gmx.at"
|
||||
DOMAIN_GMX_FR = "gmx.fr"
|
||||
DOMAIN_GMX_US = "gmx.us"
|
||||
DOMAIN_GMX_SG = "gmx.sg"
|
||||
DOMAIN_GMX_CH = "gmx.ch"
|
||||
DOMAIN_GMX_PT = "gmx.pt"
|
||||
DOMAIN_ONET = "onet.pl"
|
||||
DOMAIN_GAZETA_PL = "gazeta.pl"
|
||||
DOMAIN_NAVER = "naver.com"
|
||||
@@ -86,8 +88,9 @@ def create_imap(login: str):
|
||||
elif DOMAIN_YAHOO in login:
|
||||
imap = imaplib.IMAP4_SSL(YAHOO_IMAP_SERVER)
|
||||
elif DOMAIN_FIREMAIL_DE in login:
|
||||
imap = imaplib.IMAP4_SSL(SERVER_FIREMAIL_DE)
|
||||
elif DOMAIN_GMX in login or DOMAIN_GMX_FR in login or DOMAIN_GMX_US in login or DOMAIN_GMX_CH in login:
|
||||
# imap = imaplib.IMAP4_SSL(SERVER_FIREMAIL_DE)
|
||||
imap = IMAPClient(SERVER_FIREMAIL_DE, use_uid=True)
|
||||
elif DOMAIN_GMX in login or DOMAIN_GMX_FR in login or DOMAIN_GMX_US in login or DOMAIN_GMX_CH in login or DOMAIN_GMX_PT in login or DOMAIN_GMX_SG in login:
|
||||
imap = imaplib.IMAP4_SSL(SERVER_GMX)
|
||||
elif DOMAIN_SINA in login:
|
||||
# imap = imaplib.IMAP4_SSL(IMAP_SERVER_SINA)
|
||||
|
||||
@@ -11,7 +11,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-06-17.xlsx")
|
||||
_contacts_to_book = read_contacts("/Users/lpan/Desktop/contact_list_2024-09-16.xlsx")
|
||||
return _contacts_to_book
|
||||
|
||||
|
||||
@@ -144,22 +144,10 @@ if __name__ == '__main__':
|
||||
# MONGO_STORE_MANAGER.upload_contact_list(contacts_to_book)
|
||||
# print("start at {}".format(datetime.datetime.now()))
|
||||
# generate_valid_contact_list_for_day(segment_number=2)
|
||||
# generate_contact_from_mail_list("/Users/panlei/Downloads/邮箱及密码.xlsx")
|
||||
# generate_contact_from_mail_list("/Users/lpan/Downloads/邮箱及密码.xlsx")
|
||||
# print("end at {}".format(datetime.datetime.now()))
|
||||
generate_all_contact_list()
|
||||
# merge_contact_list_files(
|
||||
# ["/Users/lpan/Desktop/contact_list_2024-05-07.xlsx",
|
||||
# "/Users/lpan/Desktop/contact_list_2024-05-06.xlsx",
|
||||
# "/Users/lpan/Desktop/contact_list_2024-05-04.xlsx",
|
||||
# "/Users/lpan/Desktop/contact_list_2024-05-03.xlsx",
|
||||
# "/Users/lpan/Desktop/contact_list_2024-05-02.xlsx",
|
||||
# "/Users/lpan/Desktop/contact_list_2024-04-30.xlsx",
|
||||
# "/Users/lpan/Desktop/contact_list_2024-04-26.xlsx",
|
||||
# "/Users/lpan/Desktop/contact_list_2024-04-25.xlsx",
|
||||
# "/Users/lpan/Desktop/contact_list_2024-04-24.xlsx",
|
||||
# "/Users/lpan/Desktop/contact_list_2024-04-23.xlsx",
|
||||
# "/Users/lpan/Desktop/contact_list_2024-04-22.xlsx",
|
||||
# "/Users/lpan/Desktop/contact_list_2024-04-20.xlsx",
|
||||
# "/Users/lpan/Desktop/contact_list_2024-04-18.xlsx",
|
||||
# "/Users/lpan/Desktop/contact_list_2024-04-19.xlsx"])
|
||||
# ["/Users/lpan/Desktop/contact_list_all_old_not_used_contact.xlsx",
|
||||
# "/Users/lpan/Desktop/contact_list_2024-06-26.xlsx"])
|
||||
# fix_phone_number_format("/Users/lpan/Desktop/15_05_to_test.xlsx")
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import csv
|
||||
import itertools
|
||||
import random
|
||||
from concurrent.futures import ThreadPoolExecutor
|
||||
@@ -7,6 +8,7 @@ import xlsxwriter
|
||||
|
||||
from src.db.mongo_manager import MongoDbManager, MONGO_STORE_MANAGER
|
||||
from src.pojo.contact_pojo import ContactPojo
|
||||
from src.pojo.mail.mail_pojo import MailAddress
|
||||
from src.utils.contacts.generate_random_passport_id import get_random_passport_id_number
|
||||
from src.utils.excel_reader import get_random_fr_phone_numbers
|
||||
|
||||
@@ -76,11 +78,11 @@ def check_name(word_to_test: str, pinyin_name_list: list):
|
||||
return last_name, first_name
|
||||
return None
|
||||
|
||||
def generate_name_from_email(mail_address, pinyin_name_list):
|
||||
def generate_name_from_email(mail_address: list, pinyin_name_list: list):
|
||||
all_combines = get_ordered_combines(mail_address)
|
||||
all_combines.sort(key=len, reverse=True)
|
||||
cdef list no_duplicated_list = []
|
||||
cdef int min_length = 4, max_length = 18
|
||||
cdef int min_length = 5, max_length = 18
|
||||
for word in list(all_combines):
|
||||
if word not in list(no_duplicated_list) and len(word) >= min_length:
|
||||
print("add word {}".format(word))
|
||||
@@ -149,6 +151,25 @@ def generate_contact_from_mail_list(_start_position: int, _end_position: int,
|
||||
executor.submit(find_contact, generate_contacts, mail, pinyin_name_list)
|
||||
write_new_contacts_to_excel(generate_contacts)
|
||||
|
||||
def generate_contact_from_csv_file(file_path: str,
|
||||
name_list_file_path="all_new_name_list.txt"):
|
||||
_mail_list = []
|
||||
with open(file_path, newline='\n') as csvfile:
|
||||
reader = csv.DictReader(csvfile)
|
||||
for row in reader:
|
||||
_mail = row['mail']
|
||||
_password = row['password']
|
||||
_mail_list.append(MailAddress(_mail, _password))
|
||||
print("mail_list size before filter is {}".format(len(_mail_list)))
|
||||
print("mail_list size after filter is {}".format(len(_mail_list)))
|
||||
cdef list generate_contacts = []
|
||||
pinyin_name_list = read_pinyin_list_from_file(name_list_file_path)
|
||||
# random.shuffle(pinyin_name_list)
|
||||
with ThreadPoolExecutor(max_workers=len(_mail_list)) as executor:
|
||||
for mail in _mail_list:
|
||||
executor.submit(find_contact, generate_contacts, mail, pinyin_name_list)
|
||||
write_new_contacts_to_excel(generate_contacts)
|
||||
|
||||
def filter_already_validated_contacts(_list_to_extract):
|
||||
_already_validated_contact_list = MONGO_STORE_MANAGER.get_all_contacts_to_book()
|
||||
for _validated_contact in _already_validated_contact_list:
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import csv
|
||||
|
||||
import itertools
|
||||
import random
|
||||
from concurrent.futures import ThreadPoolExecutor
|
||||
@@ -6,6 +8,7 @@ import xlsxwriter
|
||||
|
||||
from src.db.mongo_manager import MongoDbManager, MONGO_STORE_MANAGER
|
||||
from src.pojo.contact_pojo import ContactPojo
|
||||
from src.pojo.mail.mail_pojo import MailAddress
|
||||
from src.utils.excel_reader import get_random_fr_phone_numbers, ExcelHelper
|
||||
from src.utils.contacts.generate_random_passport_id import get_random_passport_id_number
|
||||
|
||||
@@ -237,10 +240,29 @@ def filter_already_validated_contacts(_list_to_extract):
|
||||
_list_to_extract.remove(_extracted_contact)
|
||||
|
||||
|
||||
def generate_contact_from_csv_file(file_path: str,
|
||||
name_list_file_path="all_new_name_list.txt"):
|
||||
_mail_list = []
|
||||
with open(file_path, newline='\n') as csvfile:
|
||||
reader = csv.DictReader(csvfile)
|
||||
for row in reader:
|
||||
_mail = row['mail']
|
||||
_password = row['password']
|
||||
_mail_list.append(MailAddress(_mail, _password))
|
||||
print("mail_list size before filter is {}".format(len(_mail_list)))
|
||||
print("mail_list size after filter is {}".format(len(_mail_list)))
|
||||
generate_contacts = []
|
||||
pinyin_name_list = read_pinyin_list_from_file(name_list_file_path)
|
||||
# random.shuffle(pinyin_name_list)
|
||||
with ThreadPoolExecutor(max_workers=len(_mail_list)) as executor:
|
||||
for mail in _mail_list:
|
||||
executor.submit(find_contact, generate_contacts, mail, pinyin_name_list)
|
||||
write_new_contacts_to_excel(generate_contacts)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
start_position = 1
|
||||
end_position = 3
|
||||
# x = range(start_position, end_position, 100)
|
||||
step = 1
|
||||
step_list = range(start_position, end_position, step)
|
||||
print(step_list[-1])
|
||||
|
||||
@@ -48,7 +48,7 @@ def generate_mail_address(name):
|
||||
if __name__ == '__main__':
|
||||
pinyin_name_list = read_pinyin_list_from_file()
|
||||
random.shuffle(pinyin_name_list)
|
||||
_size = 500
|
||||
_size = 100
|
||||
_name_list = pinyin_name_list[0:_size]
|
||||
# write to excel
|
||||
_recovery_mail_list = get_recover_mail_list(_size)
|
||||
|
||||
@@ -1,22 +1,25 @@
|
||||
from cython_extract_methods import generate_contact_from_mail_list
|
||||
|
||||
# from extract_name_with_pinyinlist import generate_contact_from_mail_list
|
||||
from extract_name_with_pinyinlist import generate_contact_from_csv_file
|
||||
|
||||
if __name__ == '__main__':
|
||||
start_position = 1
|
||||
end_position = 202
|
||||
# x = range(start_position, end_position, 100)
|
||||
step = 200
|
||||
step_list = range(start_position, end_position, step)
|
||||
print(step_list[-1])
|
||||
for x in step_list:
|
||||
print(x)
|
||||
_from_position = x
|
||||
_end_position = x + step
|
||||
print("_from_position is {},_end_position is {}".format(_from_position, _end_position))
|
||||
if _end_position <= step_list[-1]:
|
||||
print("start extraction from {} to {}".format(_from_position, _end_position))
|
||||
generate_contact_from_mail_list(_from_position, _end_position,
|
||||
name_list_file_path="/Users/lpan/Documents/workspace/appointment_tool/src/person_name/all_new_name_list.txt")
|
||||
else:
|
||||
print("stop with {},{}".format(_from_position, _end_position))
|
||||
generate_contact_from_csv_file('/Users/lpan/Downloads/gmx_sg_100.csv',
|
||||
name_list_file_path="/Users/lpan/Documents/workspace/appointment_tool/src/person_name/all_new_name_list.txt")
|
||||
#
|
||||
# start_position = 20827
|
||||
# end_position = 21528
|
||||
# # x = range(start_position, end_position, 100)
|
||||
# step = 700
|
||||
# step_list = range(start_position, end_position, step)
|
||||
# print(step_list[-1])
|
||||
# for x in step_list:
|
||||
# print(x)
|
||||
# _from_position = x
|
||||
# _end_position = x + step
|
||||
# print("_from_position is {},_end_position is {}".format(_from_position, _end_position))
|
||||
# if _end_position <= step_list[-1]:
|
||||
# print("start extraction from {} to {}".format(_from_position, _end_position))
|
||||
# generate_contact_from_mail_list(_from_position, _end_position,
|
||||
# name_list_file_path="/Users/lpan/Documents/workspace/appointment_tool/src/person_name/all_new_name_list.txt")
|
||||
# else:
|
||||
# print("stop with {},{}".format(_from_position, _end_position))
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
class MailAddress:
|
||||
|
||||
def __init__(self, mail, password):
|
||||
self.mail = mail
|
||||
self.password = password
|
||||
|
||||
@@ -3,81 +3,9 @@
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
||||
<style type="text/css">/* reset */
|
||||
#outlook a {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
/* Force Outlook to provide a "view in browser" menu link. */
|
||||
.ExternalClass {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
/* Force Hotmail to display emails at full width */
|
||||
.ExternalClass, .ExternalClass p, .ExternalClass span, .ExternalClass font, .ExternalClass td, .ExternalClass div {
|
||||
line-height: 100%;
|
||||
}
|
||||
|
||||
/* Forces Hotmail to display normal line spacing. More on that: http://www.emailonacid.com/forum/viewthread/43/ */
|
||||
p {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
font-size: 0px;
|
||||
line-height: 0px;
|
||||
}
|
||||
|
||||
/* squash Exact Target injected paragraphs */
|
||||
table td {
|
||||
border-collapse: collapse;
|
||||
}
|
||||
|
||||
/* Outlook 07, 10 padding issue fix */
|
||||
table {
|
||||
border-collapse: collapse;
|
||||
mso-table-lspace: 0pt;
|
||||
mso-table-rspace: 0pt;
|
||||
}
|
||||
|
||||
/* remove spacing around Outlook 07, 10 tables *//* bring inline */
|
||||
img {
|
||||
display: block;
|
||||
outline: none;
|
||||
text-decoration: none;
|
||||
-ms-interpolation-mode: bicubic;
|
||||
}
|
||||
|
||||
a img {
|
||||
border: none;
|
||||
}
|
||||
|
||||
a {
|
||||
text-decoration: none;
|
||||
color: #3a3aff;
|
||||
}
|
||||
|
||||
/* text link */
|
||||
a.phone {
|
||||
text-decoration: none;
|
||||
color: #3a3aff !important;
|
||||
pointer-events: auto;
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
/* phone link, use as wrapper on phone numbers */
|
||||
span {
|
||||
font-size: 14px;
|
||||
line-height: 20px;
|
||||
font-family: monospace;
|
||||
color: #000001;
|
||||
}
|
||||
|
||||
table td {
|
||||
font-size: 14px;
|
||||
line-height: 20px;
|
||||
font-family: "Palatino Linotype", "Book Antiqua", Palatino, serif;
|
||||
color: #666;
|
||||
text-align: justify;
|
||||
}</style>
|
||||
<style type="text/css">
|
||||
/* reset */#outlook a {padding:0;} /* Force Outlook to provide a "view in browser" menu link. */.ExternalClass {width:100%;} /* Force Hotmail to display emails at full width */.ExternalClass, .ExternalClass p, .ExternalClass span, .ExternalClass font, .ExternalClass td, .ExternalClass div {line-height: 100%;} /* Forces Hotmail to display normal line spacing. More on that: http://www.emailonacid.com/forum/viewthread/43/ */p {margin: 0; padding: 0; font-size: 0px; line-height: 0px;} /* squash Exact Target injected paragraphs */table td {border-collapse: collapse;} /* Outlook 07, 10 padding issue fix */table {border-collapse: collapse; mso-table-lspace:0pt; mso-table-rspace:0pt; } /* remove spacing around Outlook 07, 10 tables *//* bring inline */img {display: block; outline: none; text-decoration: none; -ms-interpolation-mode: bicubic;}a img {border: none;}a {text-decoration: none; color: #3a3aff;} /* text link */a.phone {text-decoration: none; color: #3a3aff !important; pointer-events: auto; cursor: default;} /* phone link, use as wrapper on phone numbers */span {font-size: 14px; line-height: 20px; font-family: monospace; color: #000001;}table td { font-size: 14px; line-height: 20px; font-family: "Palatino Linotype", "Book Antiqua", Palatino, serif; color: #666; text-align: justify;}
|
||||
</style>
|
||||
<!--[if gte mso 9]>
|
||||
<style>/* Target Outlook 2007 and 2010 */</style><![endif]--></head>
|
||||
<body style="width:100%; margin:0; padding:0; -webkit-text-size-adjust:100%; -ms-text-size-adjust:100%;">
|
||||
@@ -109,36 +37,37 @@
|
||||
<table style="width: 100%;" cellpadding="0" cellspacing="0" border="0"
|
||||
align="center">
|
||||
<tr>
|
||||
<td valign="top" style="padding-top: 15px;">Dear Madam / Dear
|
||||
Sir,
|
||||
<td valign="top" style="padding-top: 15px;">Chère Madame, Cher
|
||||
Monsieur,
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" style="padding-top: 15px;">We are pleased to
|
||||
confirm your appointment.
|
||||
<td valign="top" style="padding-top: 15px;">Nous avons le
|
||||
plaisir de vous confirmer votre rendez-vous.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" style="padding-top: 15px;">You will be welcomed
|
||||
on Jan 16, 2023 in our store at 24 Faubourg Saint-Honoré at
|
||||
5:40 PM.
|
||||
<td valign="top" style="padding-top: 15px;">Nous vous
|
||||
accueillerons le 7 sept. 2024 au 24 Faubourg Saint-Honoré à
|
||||
14:25.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" style="padding-top: 15px;">The given hour might
|
||||
be subject to change. Please kindly follow up on your
|
||||
appointment status on <a href="/client/97C7S9">https://rendezvousparis.hermes.com/client/97C7S9</a>
|
||||
<td valign="top" style="padding-top: 15px;">Cet horaire
|
||||
indicatif est susceptible de varier. Vous pouvez suivre son
|
||||
évolution sur le site <a href="/client/UETAQQ">https://rendezvousparis.hermes.com/client/UETAQQ</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" style="padding-top: 15px;">As your appointment
|
||||
approaches, we invite you to introduce yourself to one of
|
||||
our receptionists.
|
||||
<td valign="top" style="padding-top: 15px;">A l’approche de
|
||||
votre rendez-vous, nous vous invitons à vous présenter à
|
||||
l’un de nos Chargés d’Accueil.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" style="padding-top: 15px;">Please bring the
|
||||
proof of identity used on our website.
|
||||
<td valign="top" style="padding-top: 15px;">Nous vous remercions
|
||||
de vous munir de la pièce d’identité utilisée sur notre
|
||||
site.
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
from src.utils.excel_reader import read_contacts
|
||||
|
||||
_contact_list = read_contacts(file_name="/Users/panlei/Desktop/yahoo_aol_valid_23.xlsx")
|
||||
_contact_list = read_contacts(file_name="/Users/panlei/Desktop/contact_list_2024-04-03.xlsx")
|
||||
# print(_contact_list)
|
||||
for _contact in _contact_list:
|
||||
if _contact.last_name is None or _contact.first_name is None:
|
||||
|
||||
@@ -6,7 +6,7 @@ from src.utils.excel_reader import read_contacts
|
||||
|
||||
# 检查联系人表的有邮件有没有在数据库中
|
||||
if __name__ == '__main__':
|
||||
contacts = read_contacts(str(Path.home()) + "/Desktop/contact_list_2024-06-01.xlsx")
|
||||
contacts = read_contacts(str(Path.home()) + "/Desktop/30_05_to_test.xlsx")
|
||||
mail_list = MONGO_STORE_MANAGER.get_destination_emails()
|
||||
print("mail_list size is " + str(len(mail_list)))
|
||||
mail_raw_list = []
|
||||
|
||||
@@ -26,6 +26,7 @@ def get_contact_list() -> list:
|
||||
def get_info_from_ip(ip_address) -> Union[None, IPLocationInfo]:
|
||||
_ip_info = None
|
||||
try:
|
||||
print("get ip info from ip address: " + ip_address)
|
||||
response = requests.get("http://ip-api.com/json/" + ip_address)
|
||||
response.raise_for_status()
|
||||
ip_in_dict = json.loads(response.text)
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
from src import config
|
||||
from src.mail.mail_sender import MailSender
|
||||
|
||||
store = "Hermès Paris Faubourg"
|
||||
# store = "Hermès Paris George V"
|
||||
# store = "Hermès Paris Sèvres"
|
||||
# dest_email = "928490803@qq.com"
|
||||
# dest_email = "1757344572@qq.com"
|
||||
# dest_email = "392417782@qq.com"
|
||||
# dest_email = "linghuili@hotmail.com"
|
||||
dest_email = "panleicim@gmail.com"
|
||||
# dest_email = "fanfan19810617@icloud.com"
|
||||
# dest_email = "fanchunying323@163.com"
|
||||
# dest_email = "lytlaure@gmail.com"
|
||||
# dest_email = "arianezhangsn@yahoo.com"
|
||||
# dest_email = "tranthu.ht1983@gmail.com"
|
||||
# dest_email = "124652097@qq.com"
|
||||
# dest_email = "sunrose75015@gmail.com"
|
||||
# dest_email = "1340219934@qq.com" #小于
|
||||
# dest_email = "lytlaure@gmail.com"
|
||||
# dest_email = "m13805869912@163.com"
|
||||
# dest_email = "tangliang0411@gmail.com"
|
||||
contact_name = "LONG luji"
|
||||
|
||||
f = open(config.ROOT_DIR + "/templates/confirmed_rdv.html", "r")
|
||||
email_body = f.read()
|
||||
print(email_body)
|
||||
sender = MailSender(dest_email=dest_email, email_body=email_body, store=store, contact_name=contact_name)
|
||||
print(sender.send().json)
|
||||
Reference in New Issue
Block a user