added resident_card_number field
This commit is contained in:
@@ -15,7 +15,7 @@ class MailManager:
|
||||
for item in not_validated_items:
|
||||
if "@gmail" not in item.email and "@163" not in item.email and "@hotmail" not in item.email:
|
||||
invalid_contacts.append(
|
||||
ContactPojo(phone_number=item.phone, passport_number=item.passport, last_name=item.lastName,
|
||||
ContactPojo(phone_number=item.phone, passport=item.passport, last_name=item.lastName,
|
||||
first_name=item.firstName, mail=item.email, ))
|
||||
return invalid_contacts
|
||||
|
||||
@@ -29,7 +29,7 @@ class MailManager:
|
||||
for item in validated_items:
|
||||
if "@aol" in item.email:
|
||||
valid_contacts.append(
|
||||
ContactPojo(phone_number=item.phone, passport_number=item.passport, last_name=item.lastName,
|
||||
ContactPojo(phone_number=item.phone, passport=item.passport, last_name=item.lastName,
|
||||
first_name=item.firstName, mail=item.email, ))
|
||||
return valid_contacts
|
||||
|
||||
|
||||
@@ -5,7 +5,6 @@ from pathlib import Path
|
||||
import xlsxwriter
|
||||
|
||||
from src.db.mongo_manager import MONGO_STORE_MANAGER
|
||||
from src.person_name.cython_extract_methods import filter_already_validated_contacts, read_pinyin_list_from_file
|
||||
from src.pojo.contact_pojo import ContactPojo
|
||||
from src.utils.contacts.generate_random_passport_id import generate_single_titre_sejour_number
|
||||
from src.utils.excel_reader import read_contacts, fr_phone_number_prefix, get_random_fr_phone_numbers, ExcelHelper
|
||||
@@ -17,7 +16,7 @@ DEFAULT_SERIAL_TO_IGNORE = ["47e7e36b", "bitbrowser"]
|
||||
|
||||
|
||||
def upload_contacts_list():
|
||||
_contacts_to_book = read_contacts(str(Path.home()) + "/Desktop/contact_list_200_aol_10_01_2025.xlsx")
|
||||
_contacts_to_book = read_contacts(str(Path.home()) + "/Desktop/contact_list_2025-01-24.xlsx")
|
||||
return _contacts_to_book
|
||||
|
||||
|
||||
@@ -57,7 +56,7 @@ def generate_contact_from_mail_list(mail_list_file,
|
||||
name = random.choice(pinyin_name_list)
|
||||
last_name = name.split(" ")[0]
|
||||
first_name = name.split(" ")[1]
|
||||
contact = ContactPojo(mail=mail.mail, phone_number=phone_number, passport_number=passport_number,
|
||||
contact = ContactPojo(mail=mail.mail, phone_number=phone_number, passport=passport_number,
|
||||
last_name=last_name, first_name=first_name, store="random")
|
||||
generate_contacts.append(contact)
|
||||
write_new_contacts_to_excel(generate_contacts)
|
||||
@@ -68,7 +67,8 @@ 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', 'serial', 'ip_country', 'ua']
|
||||
header_data = ['name', 'phone', 'passport', 'email', 'store', 'serial', 'ip_country', 'ua',
|
||||
'resident_card_number']
|
||||
worksheet = workbook.add_worksheet()
|
||||
header_format = workbook.add_format({'bold': True})
|
||||
|
||||
@@ -85,12 +85,13 @@ def write_new_contacts_to_excel(valid_contacts: list, file_name=str(datetime.dat
|
||||
worksheet.write(row, col + 5, info.serial)
|
||||
worksheet.write(row, col + 6, info.ip_country)
|
||||
worksheet.write(row, col + 7, info.ua)
|
||||
worksheet.write(row, col + 8, info.resident_card_number)
|
||||
row += 1
|
||||
workbook.close()
|
||||
|
||||
|
||||
def generate_valid_contact_list_for_day(segment_number=1):
|
||||
_collection_name = "2025-01-14"
|
||||
_collection_name = "2025-01-24"
|
||||
_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 = []
|
||||
@@ -104,6 +105,10 @@ def generate_valid_contact_list_for_day(segment_number=1):
|
||||
_contact.phone = _true_contact.phone
|
||||
_contact.passport = _true_contact.passport
|
||||
_contact.first_name = _true_contact.first_name
|
||||
if _contact.resident_card_number is None or len(_contact.resident_card_number) == 0:
|
||||
for _true_contact in _all_contacts:
|
||||
if _true_contact.mail == _contact.mail:
|
||||
_contact.resident_card_number = _true_contact.resident_card_number
|
||||
|
||||
# if len(_contact.serial) == 0:
|
||||
# _contact.serial = DEFAULT_SERIAL
|
||||
@@ -165,8 +170,9 @@ def generate_all_contact_list():
|
||||
random.shuffle(_all_contacts)
|
||||
for _contact in _all_contacts:
|
||||
_contact.store = "random"
|
||||
_contact.resident_card_number = generate_single_titre_sejour_number()
|
||||
write_new_contacts_to_excel(_all_contacts, file_name="all")
|
||||
write_list_with_segment_number("all", _all_contacts, 31)
|
||||
write_list_with_segment_number("all", _all_contacts, 1)
|
||||
|
||||
|
||||
def write_to_black_list(contacts: list):
|
||||
@@ -224,17 +230,16 @@ 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_contact_from_mail_list("/Users/lpan/Downloads/邮箱及密码_yahoo_100_16_01_2025.xlsx")
|
||||
# print("end at {}".format(datetime.datetime.now()))
|
||||
# update_contact_list_not_received_mail()
|
||||
# generate_valid_contact_list_for_day(segment_number=2)
|
||||
# get_old_validated_contact_list()
|
||||
# print("end at {}".format(datetime.datetime.now()))
|
||||
generate_all_contact_list()
|
||||
# generate_all_contact_list()
|
||||
# merge_contact_list_files(
|
||||
# ["/Users/lpan/Desktop/contact_list_2024-11-04.xlsx",
|
||||
# "/Users/lpan/Desktop/contact_list_2024-11-07.xlsx",
|
||||
|
||||
@@ -203,7 +203,7 @@ def write_new_contacts_to_excel(valid_contacts: list):
|
||||
|
||||
|
||||
def find_contact(generate_contacts: list, mail, pinyin_name_list):
|
||||
contact = ContactPojo(mail=mail.mail, phone_number="", passport_number="", last_name="", first_name="",
|
||||
contact = ContactPojo(mail=mail.mail, phone_number="", passport="", last_name="", first_name="",
|
||||
store="random")
|
||||
splitted = mail.mail.split("@")
|
||||
possible_name_list = generate_name_from_email(splitted[0], pinyin_name_list)
|
||||
|
||||
@@ -17,16 +17,17 @@ class ContactPojo:
|
||||
ua: str = ""
|
||||
serial: str = ""
|
||||
model: str = ""
|
||||
resident_card_number: str = ""
|
||||
|
||||
def __repr__(self):
|
||||
return "phone:{}, passport:{}, last_name:{}, first_name:{}, mail:{}, store:{}, ip_country:{},isp:{}".format(
|
||||
self.phone, self.passport, self.last_name, self.first_name, self.mail, self.store, self.ip_country,
|
||||
self.isp)
|
||||
|
||||
def __init__(self, phone_number: str, passport_number: str, last_name: str, first_name: str, mail: str, store: str,
|
||||
def __init__(self, phone_number: str, passport: str, last_name: str, first_name: str, mail: str, store: str,
|
||||
ip_country="FR"):
|
||||
self.phone = str(phone_number).replace(".0", "")
|
||||
self.passport = passport_number
|
||||
self.passport = passport
|
||||
self.last_name = last_name
|
||||
self.first_name = first_name
|
||||
self.mail = mail
|
||||
@@ -44,6 +45,7 @@ class ContactPojo:
|
||||
dest = {
|
||||
u'phone': self.phone,
|
||||
u'passport': self.passport,
|
||||
u'resident_card_number': self.resident_card_number,
|
||||
u'last_name': self.last_name,
|
||||
u'first_name': self.first_name,
|
||||
u'mail': self.mail,
|
||||
@@ -59,7 +61,7 @@ class ContactPojo:
|
||||
def get_contact_from_error_contact(errorContact: ContactInErrorPojo):
|
||||
return ContactPojo(phone_number=errorContact.phone, mail=errorContact.mail,
|
||||
last_name=errorContact.last_name, first_name=errorContact.first_name,
|
||||
passport_number=errorContact.passport)
|
||||
passport=errorContact.passport)
|
||||
|
||||
@staticmethod
|
||||
def from_firestore_dict(source):
|
||||
@@ -77,7 +79,7 @@ class ContactPojo:
|
||||
ua = ""
|
||||
if source.get('ua'):
|
||||
ua = source['ua']
|
||||
result = ContactPojo(phone_number=phone, passport_number=passport, mail=email,
|
||||
result = ContactPojo(phone_number=phone, passport=passport, mail=email,
|
||||
last_name=last_name, first_name=first_name, store=store)
|
||||
result.ip_country = ip_country
|
||||
if source.get('current_ip'):
|
||||
@@ -88,5 +90,8 @@ class ContactPojo:
|
||||
if source.get('source_from'):
|
||||
model = source['source_from']
|
||||
result.model = model
|
||||
if source.get('resident_card_number'):
|
||||
resident_card_number = source['resident_card_number']
|
||||
result.resident_card_number = resident_card_number
|
||||
result.ua = ua
|
||||
return result
|
||||
|
||||
@@ -66,7 +66,7 @@ def generate_not_used_contact_list():
|
||||
if contact.mail == mail_item.mail:
|
||||
if contact.phone is not None and len(contact.phone) > 0:
|
||||
new_contact = ContactPojo(mail=mail_item.mail, phone_number=contact.phone,
|
||||
passport_number=contact.passport,
|
||||
passport=contact.passport,
|
||||
last_name=contact.last_name, first_name=contact.first_name,
|
||||
store="random")
|
||||
contact_list.append(new_contact)
|
||||
@@ -75,7 +75,7 @@ def generate_not_used_contact_list():
|
||||
|
||||
|
||||
def upload_to_collection():
|
||||
_contacts = read_contacts(str(Path.home()) + "/Desktop/contact_list_2024-11-05.xlsx")
|
||||
_contacts = read_contacts(str(Path.home()) + "/Desktop/contact_list_2025-01-06.xlsx")
|
||||
MONGO_STORE_MANAGER.upload_contact_list_to_collection(_contacts,"CONTACT_LIST_SERIAL_MAP")
|
||||
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ def get_contact_list() -> list:
|
||||
for item in _successful_items:
|
||||
if item.url_validated:
|
||||
_contact = ContactPojo(first_name=item.first_name, last_name=item.last_name, mail=item.mail,
|
||||
phone_number=item.phone, passport_number=item.passport, store=item.store)
|
||||
phone_number=item.phone, passport=item.passport, store=item.store)
|
||||
_contact.ip_address = item.ip_address
|
||||
_contact.created_at = item.created_at
|
||||
_contact_list.append(_contact)
|
||||
|
||||
@@ -56,11 +56,14 @@ def read_contacts(file_name) -> list:
|
||||
contact = ContactPojo(phone_number=contact_dict['phone'],
|
||||
last_name=last_name,
|
||||
first_name=first_name,
|
||||
passport_number=contact_dict['passport'],
|
||||
passport=contact_dict['passport'],
|
||||
mail=contact_dict['email'], store=store)
|
||||
if contact_dict.get('serial') is not None:
|
||||
serial = contact_dict['serial']
|
||||
contact.serial = serial
|
||||
if contact_dict.get('resident_card_number') is not None:
|
||||
resident_card_number = contact_dict['resident_card_number']
|
||||
contact.resident_card_number = resident_card_number
|
||||
contact.ip_country = ip_country
|
||||
contact.ua = ua
|
||||
contact_list.append(contact)
|
||||
@@ -135,7 +138,7 @@ class ExcelHelper:
|
||||
contact = ContactPojo(phone_number="",
|
||||
last_name=last_name,
|
||||
first_name=first_name,
|
||||
passport_number="",
|
||||
passport="",
|
||||
mail="")
|
||||
|
||||
if len(first_name) == 0:
|
||||
|
||||
@@ -94,7 +94,7 @@ if __name__ == '__main__':
|
||||
# mail_list = db_manager.get_destination_emails()[50:200]
|
||||
generate_contacts = []
|
||||
for mail in mail_list:
|
||||
contact = ContactPojo(mail=mail.mail, phone_number="", passport_number="", last_name="", first_name="")
|
||||
contact = ContactPojo(mail=mail.mail, phone_number="", passport="", last_name="", first_name="")
|
||||
spliteed = mail.mail.split("@")
|
||||
possible_name_list = generate_name_from_email(spliteed[0])[0]
|
||||
chinese_name_list = generate_name_from_email(spliteed[0])[1]
|
||||
|
||||
@@ -437,7 +437,7 @@ def on_success(result: ReserveResultPojo):
|
||||
|
||||
|
||||
def launch_page():
|
||||
contact = ContactPojo(phone_number="+33758912245", passport_number="82546975", last_name="XU",
|
||||
contact = ContactPojo(phone_number="+33758912245", passport="82546975", last_name="XU",
|
||||
first_name="xingzhen",
|
||||
mail="ColbyPatel653@gmail.com", ccid="", position=0)
|
||||
page = CommandorPage(contact, store_type=1)
|
||||
|
||||
Reference in New Issue
Block a user