If you're testing forms, mockups, or just want to play with data, there's Mimesis β a generator of fake data. Names, emails, addresses, and phone numbers. There's a location setting that allows you to select a country, and the data will be generated accordingly.
from typing import Dict
from mimesis.enums import Gender
from mimesis import Person
def generate_fake_user(locale: str = "es", gender: Gender = Gender.MALE) -> Dict[str, str]:
"""
Generates fake user data based on the locale and gender.
:param locale: The locale (for example, 'ru', 'en', 'es')
:param gender: The gender (Gender.MALE or Gender.FEMALE)
:return: A dictionary with the fake user data
"""
person = Person(locale)
user_data = {
"name": person.full_name(gender=gender),
"height": person.height(),
"phone": person.telephone(),
"occupation": person.occupation(),
}
return user_data
if __name__ == "__main__":
fake_user = generate_fake_user(locale="es", gender=Gender.MALE)
print(fake_user)
{
'name': 'Carlos Herrera',
'height': '1.84',
'phone': '912 475 289',
'occupation': 'Arquitecto'
)ru, πΊπΈ en, πͺπΈ es, etc.) Save it, it'll come in handy
#python #github #interview
Please open Telegram to view this post
VIEW IN TELEGRAM
β€5