support serial
This commit is contained in:
@@ -9,9 +9,11 @@ from src.pojo.contact_pojo import ContactPojo
|
||||
from src.utils.contacts.generate_random_passport_id import get_random_passport_id_number
|
||||
from src.utils.excel_reader import read_contacts, fr_phone_number_prefix, get_random_fr_phone_numbers, ExcelHelper
|
||||
|
||||
DEFAULT_SERIAL = "47e7e36b"
|
||||
|
||||
|
||||
def upload_contacts_list():
|
||||
_contacts_to_book = read_contacts("/Users/lpan/Desktop/contact_list_2024-09-27_today.xlsx")
|
||||
_contacts_to_book = read_contacts("/Users/lpan/Desktop/contact_list_2024-09-28.xlsx")
|
||||
return _contacts_to_book
|
||||
|
||||
|
||||
@@ -61,7 +63,7 @@ def write_new_contacts_to_excel(valid_contacts: list, file_name=str(datetime.dat
|
||||
col = 0
|
||||
# Create a workbook and add a worksheet.
|
||||
workbook = xlsxwriter.Workbook('contact_list_{}.xlsx'.format(file_name))
|
||||
header_data = ['name', 'phone', 'passport', 'email', 'store', 'ip_country', 'ua']
|
||||
header_data = ['name', 'phone', 'passport', 'email', 'store', 'serial', 'ip_country', 'ua']
|
||||
worksheet = workbook.add_worksheet()
|
||||
header_format = workbook.add_format({'bold': True})
|
||||
|
||||
@@ -75,14 +77,16 @@ def write_new_contacts_to_excel(valid_contacts: list, file_name=str(datetime.dat
|
||||
worksheet.write(row, col + 2, info.passport)
|
||||
worksheet.write(row, col + 3, info.mail)
|
||||
worksheet.write(row, col + 4, info.store)
|
||||
worksheet.write(row, col + 5, info.ip_country)
|
||||
worksheet.write(row, col + 6, info.ua)
|
||||
worksheet.write(row, col + 5, info.serial)
|
||||
worksheet.write(row, col + 6, info.ip_country)
|
||||
worksheet.write(row, col + 7, info.ua)
|
||||
row += 1
|
||||
workbook.close()
|
||||
|
||||
|
||||
def generate_valid_contact_list_for_day(segment_number=1):
|
||||
_valid_contact_list = MONGO_STORE_MANAGER.get_all_successful_items_for_day()
|
||||
_collection_name = "2024-09-23"
|
||||
_valid_contact_list = MONGO_STORE_MANAGER.get_all_successful_items_for_one_day(_collection_name)
|
||||
_all_contacts = MONGO_STORE_MANAGER.get_all_contacts_to_book()
|
||||
_contact_to_save = []
|
||||
for _contact in _valid_contact_list:
|
||||
@@ -96,6 +100,8 @@ def generate_valid_contact_list_for_day(segment_number=1):
|
||||
_contact.passport = _true_contact.passport
|
||||
_contact.first_name = _true_contact.first_name
|
||||
|
||||
if len(_contact.serial) == 0:
|
||||
_contact.serial = DEFAULT_SERIAL
|
||||
if _contact.url_validated:
|
||||
if _contact.last_name is not None and len(_contact.last_name) > 0:
|
||||
_need_to_save = True
|
||||
@@ -107,14 +113,15 @@ def generate_valid_contact_list_for_day(segment_number=1):
|
||||
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)
|
||||
_contact_to_save_list = _contact_to_save
|
||||
write_new_contacts_to_excel(_contact_to_save_list)
|
||||
write_new_contacts_to_excel(_contact_to_save_list, file_name=_collection_name)
|
||||
for i in range(0, segment_number):
|
||||
_step = int(len(_contact_to_save_list) / segment_number)
|
||||
_sublist = _contact_to_save_list[i * _step:_step * (i + 1)]
|
||||
_file_name = str(datetime.date.today()) + "_" + str(i + 1)
|
||||
_file_name = _collection_name + "_" + str(i + 1)
|
||||
write_new_contacts_to_excel(_sublist, file_name=_file_name)
|
||||
|
||||
|
||||
@@ -150,7 +157,7 @@ def update_contact_list_not_received_mail():
|
||||
write_to_black_list([_contact])
|
||||
|
||||
|
||||
def get_old_validated_contact_list(remove_blacklisted_contact=True, _day_in_str="2024-09-09"):
|
||||
def get_old_validated_contact_list(remove_blacklisted_contact=True, _day_in_str="2024-09-06"):
|
||||
_valid_contact_list = MONGO_STORE_MANAGER.get_all_successful_items_for_one_day(_day_in_str)
|
||||
_domain_list_to_remove = ["firemail.de", "onet.pl", "yahoo.com", "gmx.com"]
|
||||
_all_contacts = MONGO_STORE_MANAGER.get_all_contacts_to_book()
|
||||
@@ -193,10 +200,10 @@ def get_old_validated_contact_list(remove_blacklisted_contact=True, _day_in_str=
|
||||
|
||||
# 把新的联系人存到网上
|
||||
if __name__ == '__main__':
|
||||
contacts_to_book = upload_contacts_list()
|
||||
MONGO_STORE_MANAGER.upload_contact_list(contacts_to_book)
|
||||
# contacts_to_book = upload_contacts_list()
|
||||
# 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_valid_contact_list_for_day(segment_number=2)
|
||||
# generate_contact_from_mail_list("/Users/lpan/Downloads/邮箱及密码.xlsx")
|
||||
# print("end at {}".format(datetime.datetime.now()))
|
||||
# update_contact_list_not_received_mail()
|
||||
|
||||
Reference in New Issue
Block a user