make mail validator headless

This commit is contained in:
2022-09-26 17:26:21 +02:00
parent 7272310fbd
commit 3a205811a8
3 changed files with 25 additions and 8 deletions
+1 -1
View File
@@ -189,7 +189,7 @@ def read_mails():
if need_to_valid_url(url, successful_items): if need_to_valid_url(url, successful_items):
url_validator = LinkValidator(url) url_validator = LinkValidator(url)
print("need to validate url: " + url) print("need to validate url: " + url)
executor.submit(url_validator.start_page, params.get_proxy(ProxyType.RESIDENTIAL), False) executor.submit(url_validator.start_page, params.get_proxy(ProxyType.RESIDENTIAL), True)
else: else:
print("do not need to click url --> {}".format(mail.mail_address)) print("do not need to click url --> {}".format(mail.mail_address))
+3 -4
View File
@@ -213,10 +213,9 @@ def save_mails_to_db():
if __name__ == '__main__': if __name__ == '__main__':
excel_reader = ExcelHelper() excel_reader = ExcelHelper()
excel_reader.read_user_agens() contacts = excel_reader.read_names("/Users/lpan/Documents/rdv/随机/22-09-2022/随机10.xlsx")
# contacts = excel_reader.read_names("/Users/lpan/Documents/rdv/backup_500.xlsx") print(contacts)
# print(contacts) write_new_contacts_to_excel(valid_contacts=contacts)
# write_new_contacts_to_excel(valid_contacts=contacts)
# save_mails_to_db() # save_mails_to_db()
# for mail in excel_reader.read_mails_and_pwd(): # for mail in excel_reader.read_mails_and_pwd():
+21 -3
View File
@@ -1,7 +1,6 @@
import random import random
import string import string
# letters = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'J', 'K', 'P', 'Q', 'R', 'S', 'T', '1', '2', '3', '4', '5', '6', '7', # letters = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'J', 'K', 'P', 'Q', 'R', 'S', 'T', '1', '2', '3', '4', '5', '6', '7',
# '8', '9'] # '8', '9']
from src.pojo.captcha_error_contact_pojo import ContactInErrorPojo from src.pojo.captcha_error_contact_pojo import ContactInErrorPojo
@@ -9,6 +8,8 @@ from src.pojo.contact_pojo import ContactPojo
letters = ['E', 'G', 'M'] letters = ['E', 'G', 'M']
prefix_tire_de_sejour = "9918"
def get_random_id_number() -> str: def get_random_id_number() -> str:
S = 8 # number of characters in the string. S = 8 # number of characters in the string.
@@ -16,6 +17,7 @@ def get_random_id_number() -> str:
id_number = str(ran) id_number = str(ran)
return id_number return id_number
# 产生中国护照号 # 产生中国护照号
def get_random_passport_id_number() -> str: def get_random_passport_id_number() -> str:
S = 8 # number of characters in the string. S = 8 # number of characters in the string.
@@ -24,6 +26,11 @@ def get_random_passport_id_number() -> str:
return id_number return id_number
def get_random_number(size=6) -> str:
ran = ''.join(random.choices(string.digits, k=size))
return ran
def get_captcha_error_contact_from_contact(contact: ContactPojo, error_type: int) -> ContactInErrorPojo: def get_captcha_error_contact_from_contact(contact: ContactPojo, error_type: int) -> ContactInErrorPojo:
captcha_error = ContactInErrorPojo() captcha_error = ContactInErrorPojo()
captcha_error.mail = contact.mail captcha_error.mail = contact.mail
@@ -36,8 +43,19 @@ def get_captcha_error_contact_from_contact(contact: ContactPojo, error_type: int
captcha_error.error_type = error_type captcha_error.error_type = error_type
return captcha_error return captcha_error
def generate_titre_sejour_number(size=10) -> list:
number_list = []
for i in range(0, size):
id_number = prefix_tire_de_sejour + get_random_number()
number_list.append(id_number)
return number_list
if __name__ == '__main__': if __name__ == '__main__':
# for i in range(1,200): # for i in range(1,200):
# print(get_random_id_number()) # print(get_random_id_number())
for i in range(1, 804): # for i in range(1, 804):
print(get_random_id_number()) # print(get_random_id_number())
for id in generate_titre_sejour_number(500):
print(id)