can read links excel
This commit is contained in:
@@ -3,6 +3,7 @@ import random
|
||||
import string
|
||||
|
||||
import pandas as pandas
|
||||
import validators as validators
|
||||
import xlsxwriter
|
||||
|
||||
from src.config import CONTACT_LIST_FILE
|
||||
@@ -14,16 +15,24 @@ from src.utils.generate_random_passport_id import get_random_passport_id_number
|
||||
phone_number_prefix = ['6']
|
||||
|
||||
|
||||
def read_links_to_click(file_path):
|
||||
links_info_in_json = pandas.read_excel(file_path).to_json(orient='records')
|
||||
# print(links_info_in_json)
|
||||
for item in json.loads(links_info_in_json):
|
||||
link = item['link']
|
||||
if validators.url(link):
|
||||
print(link)
|
||||
MONGO_STORE_MANAGER.save_links_to_validate(link, "")
|
||||
|
||||
else:
|
||||
print("error on link " + link)
|
||||
|
||||
|
||||
class ExcelHelper:
|
||||
|
||||
def __init__(self):
|
||||
self._df = pandas.Series()
|
||||
|
||||
def write_to_exel(self, file_name, data_list: list):
|
||||
new_df = pandas.Series(data_list)
|
||||
self._df = pandas.concat([self._df, new_df])
|
||||
self._df.to_excel(file_name)
|
||||
|
||||
def read_user_agens(self) -> list:
|
||||
user_agent_in_json = pandas.read_excel(
|
||||
"/Users/lpan/Documents/workspace/appointment_tool/docs/mobile_user_agent_list.xlsx").to_json(
|
||||
@@ -231,8 +240,9 @@ if __name__ == '__main__':
|
||||
# contacts = excel_reader.read_names("/Users/lpan/Downloads/gmail_10.xlsx")
|
||||
# print(contacts)
|
||||
# write_new_contacts_to_excel(valid_contacts=contacts)
|
||||
excel_reader = ExcelHelper()
|
||||
excel_reader.check_contact_list("/Users/lpan/Desktop/contact_email_valid.xlsx")
|
||||
# excel_reader = ExcelHelper()
|
||||
# excel_reader.check_contact_list("/Users/lpan/Desktop/contact_email_valid.xlsx")
|
||||
read_links_to_click("/Users/lpan/Downloads/链接.xlsx")
|
||||
# save_mails_to_db()
|
||||
# for mail in excel_reader.read_mails_and_pwd():
|
||||
# MONGO_STORE_MANAGER.insert_email(mail)
|
||||
|
||||
Reference in New Issue
Block a user