use brightdata proxy

This commit is contained in:
Lei PAN
2022-06-02 09:47:29 +02:00
parent b7e86fdceb
commit 69412fa942
7 changed files with 57 additions and 19 deletions
+9 -3
View File
@@ -54,6 +54,8 @@ class ExcelHelper:
name = raw_name.split(' ')
if len(name) == 1:
name = raw_name.split('\xa0')
if len(name) == 1:
print("error in " + str(name))
last_name = name[0]
if len(name) == 2:
first_name = name[-1]
@@ -85,10 +87,14 @@ def get_random_phone_numbers():
def generate_email_from_name(first_name: str, last_name: str) -> str:
length = 4 # number of characters in the string.
length = 2 # number of characters in the string.
ran = ''.join(random.choices(string.digits, k=length))
separator = ['.', '_', '']
email = "{}{}{}{}@163.com".format(last_name.lower(), random.choice(separator), first_name.lower(), ran)
domains = ['gmail.com', 'hotmail.com', 'yahoo.com', 'aol.com', 'outlook.com', 'hotmail.fr', 'gmx.com',
'hotmail.com', 'yahoo.com', 'aol.com', 'hotmail.com']
email = "{}{}{}{}@{}".format(last_name.lower(), random.choice(separator),
first_name.replace("-", "").replace("'", "").lower(), ran,
random.choice(domains))
print(email)
return email
@@ -129,6 +135,6 @@ def write_new_contacts_to_excel(valid_contacts: list):
if __name__ == '__main__':
excel_reader = ExcelHelper()
contacts = excel_reader.read_names("C:/Users/landd/Desktop/1000.xlsx")
contacts = excel_reader.read_names("C:/Users/landd/Downloads/names.xlsx")
print(contacts)
write_new_contacts_to_excel(valid_contacts=contacts)
+19
View File
@@ -0,0 +1,19 @@
import json
import requests
def generate_names() -> list:
res = requests.get(
"https://www.namegeneratorfun.com/api/namegenerator?generatorType=list&firstName=&lastName=&minLength=0&maxLength=255&sexId=2&generatorId=43")
response_json = json.loads(res.text)
names = response_json['names']
# print(names)
return names
if __name__ == '__main__':
for i in range(0, 5):
names = generate_names()
for name in names:
print(name)