added verification de URL not valide
This commit is contained in:
@@ -6,7 +6,9 @@ import pandas as pandas
|
||||
import xlsxwriter
|
||||
|
||||
from src.config import CONTACT_LIST_FILE
|
||||
from src.db.mongo_manager import MONGO_STORE_MANAGER
|
||||
from src.pojo.contact_pojo import ContactPojo
|
||||
from src.pojo.mail_pojo import Mail
|
||||
from src.utils.generate_random_passport_id import get_random_passport_id_number
|
||||
|
||||
phone_number_prefix = ['6']
|
||||
@@ -44,6 +46,19 @@ class ExcelHelper:
|
||||
contact_list.append(contact)
|
||||
return contact_list
|
||||
|
||||
def read_mails_and_pwd(self,
|
||||
file_name='/Users/lpan/Desktop/163.xlsx'):
|
||||
contact_list = []
|
||||
mail_list_in_json = pandas.read_excel(file_name).to_json(orient='records')
|
||||
contact_dict_list = json.loads(mail_list_in_json)
|
||||
for contact_dict in contact_dict_list:
|
||||
if contact_dict['mail']:
|
||||
mail = contact_dict['mail'].strip()
|
||||
pwd = contact_dict['password']
|
||||
contact = Mail(mail, pwd)
|
||||
contact_list.append(contact)
|
||||
return contact_list
|
||||
|
||||
def read_names(self, file_name=CONTACT_LIST_FILE) -> list:
|
||||
contact_list_in_json = pandas.read_excel(file_name).to_json(orient='records')
|
||||
contact_dict_list = json.loads(contact_list_in_json)
|
||||
@@ -136,6 +151,9 @@ def write_new_contacts_to_excel(valid_contacts: list):
|
||||
|
||||
if __name__ == '__main__':
|
||||
excel_reader = ExcelHelper()
|
||||
contacts = excel_reader.read_names("/Users/lpan/Downloads/real_contacts.xlsx")
|
||||
print(contacts)
|
||||
write_new_contacts_to_excel(valid_contacts=contacts)
|
||||
# contacts = excel_reader.read_names("/Users/lpan/Downloads/real_contacts.xlsx")
|
||||
# print(contacts)
|
||||
# write_new_contacts_to_excel(valid_contacts=contacts)
|
||||
for mail in excel_reader.read_mails_and_pwd():
|
||||
MONGO_STORE_MANAGER.insert_email(mail)
|
||||
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
from src.db.mongo_manager import MONGO_STORE_MANAGER
|
||||
from src.utils.excel_reader import ExcelHelper
|
||||
|
||||
mail_list = ExcelHelper().read_mails_and_pwd()
|
||||
def get_mail_list() -> list:
|
||||
mail_list = []
|
||||
resever_list = MONGO_STORE_MANAGER.get_all_successful_items_for_day()
|
||||
for reserve in resever_list:
|
||||
mail_list.append(reserve.email)
|
||||
return mail_list
|
||||
|
||||
def find_password_for_email(email:str) -> str:
|
||||
for mail_pojo in mail_list:
|
||||
if mail_pojo.mail == email:
|
||||
print(mail_pojo)
|
||||
|
||||
if __name__ == '__main__':
|
||||
mails = get_mail_list()
|
||||
print(len(mails))
|
||||
for mail in mails:
|
||||
find_password_for_email(mail)
|
||||
Reference in New Issue
Block a user