Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added a fake data generator python script #383

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions Fake_Data_Generator/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Fake Data Generator
A python script that creates a fake identity
- First Name
- Last Name
- Email
- Phone number
- City
- Street name
- Street address
- Zip Code
- State
- Country
- Job title
- Years of experience
- Salary
56 changes: 56 additions & 0 deletions Fake_Data_Generator/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
import random
import requests
import json

email_endings = ['@gmail.com', '@yahoo.com', '@hotmail.com', '@outlook.com', '@icloud.com']

random_data_generator_url = "https://random-data-api.com/api/v2/users?size=1&is_xml=true"
response = requests.get(random_data_generator_url)
data = json.loads(response.text)

#Name
first_name = data['first_name']
last_name = data['last_name']

#Email
email = data['email'].split("@")
email_numbering = [str(random.randint(1, 1000)), ""]
email = email[0] + random.choice(email_numbering) + random.choice(email_endings)
dot_or_underscore = random.choice([0, 1])
if dot_or_underscore == 1:
email = email.replace(".", "_")

#Phone
phone_number = data['phone_number']
if phone_number.count("x") != 0:
phone_number = phone_number.split("x", 1)[0]

#City
city = data['address']['city']

#Street Name
street_name = data['address']['street_name']

#Street Address
street_address = data['address']['street_address']

#Zip code
zip_code = data['address']['zip_code']

#State
state = data['address']['state']

#Country
country = data['address']['country']

#Job Title
job_title = data['employment']['title']

#years of experience
years_of_experience = random.choice(['1', '2', '3', '4', '5+'])

#Salary
salary = random.randrange(50000, 250000, 500)

data = (first_name, last_name, email, phone_number, city, street_name, street_address, zip_code, state, country, job_title, years_of_experience, salary)
print(data)
2 changes: 2 additions & 0 deletions Fake_Data_Generator/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
numpy==1.23.2
pandas==1.4.3