python3.6
Faker==2.0.3
When testing, you need to add a lot of fake data to the database
from faker import Faker
fake =Faker(locale='zh_CN') #Generate a Faker object(Chinese),English when no parameters are passed by default
Language pack:
ar_EG -Arabic(Egypt)
ar_PS -Arabic(Palestine)
ar_SA -Arabic(Saudi Arabia)
bg_BG - Bulgarian
cs_CZ - Czech
de_DE - German
dk_DK - Danish
el_GR - Greek
en_AU -English(Australia)
en_CA -English(Canada)
en_GB -English(Great Britain)
en_US -English(United States)
es_ES -Spanish(Spain)
es_MX -Spanish(Mexico)
et_EE - Estonian
fa_IR -Persian(Iran)
fi_FI - Finnish
fr_FR - French
hi_IN - Hindi
hr_HR - Croatian
hu_HU - Hungarian
it_IT - Italian
ja_JP - Japanese
ko_KR - Korean
lt_LT - Lithuanian
lv_LV - Latvian
ne_NP - Nepali
nl_NL -Dutch(Netherlands)
no_NO - Norwegian
pl_PL - Polish
pt_BR -Portuguese(Brazil)
pt_PT -Portuguese(Portugal)
ru_RU - Russian
sl_SI - Slovene
sv_SE - Swedish
tr_TR - Turkish
uk_UA - Ukrainian
zh_CN -Chinese(China)
zh_TW -Chinese(Taiwan)
Common methods:
city_suffix(): City, County
country():country
country_code(): Country code
district():Area
geo_coordinate(): Geographical coordinates
latitude(): Geographical coordinates(latitude)longitude(): Geographical coordinates(longitude)lexify(): Replace all events with random letters on the question mark ("?").
numerify(): Three random numbers
postcode(): Zip code
province():province
street_address():Street address
street_name(): Street name
street_suffix(): Street, road
random_digit():0~9 random number
random_digit_not_null():1~9 random number
random_element(): Random letters
random_int(): Random number, default 0~9999, you can set min,max to set
random_letter(): Random letters
random_number(): Random number, the number of digits generated by the parameter digits setting
color_name(): Random color name
hex_color(): Random HEX color
rgb_color(): Random RGB colors
safe_color_name(): Random safe color name
safe_hex_color(): Random safe HEX color
bs(): Random company service name
company(): Random company name (long)
company_prefix(): Random company name (short)
company_suffix():Company Type
credit_card_expire(): Random credit card expiration date
credit_card_full(): Generate complete credit card information
credit_card_number():credit card number
credit_card_provider(): Credit card type
credit_card_security_code(): Credit card security code
currency_code(): Currency code
am_pm():AM/PM
century(): Random Century
date(): Random date
date_between(): Randomly generate dates within the specified range, parameter: start_date,end_Date value: specific date or today,-30d,-30y similar
date_between_dates(): Randomly generate dates in the specified range, the usage is the same as above
date_object(): Random production from 1970-1-1 to a random date from the specified date.
date_this_month():
date_this_year():
date_time(): Randomly generate the specified time (January 1, 1970 to present)
date_time_ad(): Generate a random time from 1 AD to the present
date_time_between():The usage is the same as dates
future_date(): Future date
future_datetime(): Future time
month(): Random month
month_name(): Random month (English)
past_date(): Randomly generate dates that have passed
past_datetime(): Randomly generate elapsed time
time(): Random 24-hour time
timedelta(): Get the time difference randomly
time_object(): Random 24-hour time, time object
time_series(): Random TimeSeries object
timezone(): Random time zone
unix_time(): Random Unix time
year(): Random year
file_extension(): Random file extension
file_name(): Random file name (including extension, not including path)
file_path(): Random file path (including file name and extension)
mime_type(): Random mime Type
ascii_company_email(): Random ASCII company mailbox name
ascii_email(): Random ASCII mailbox
ascii_free_email():
ascii_safe_email():
company_email():
domain_name(): Generate domain name
domain_word(): Domain words(I.e. no suffix)email():
free_email():
free_email_domain():
f.safe_email():safe mailbox
f.image_url(): Random URL address
ipv4(): Random IP4 address
ipv6(): Random IP6 address
mac_address(): Random MAC address
tld(): URL domain suffix(.com,.net.cn,Wait, not including.)uri(): Random URI address
uri_extension(): URL file suffix
uri_page(): URL file (not including suffix)
uri_path(): URL file path (not including file name)
url(): Random URL address
user_name(): Random username
isbn10(): Random ISBN (10 bits)
isbn13(): Random ISBN (13 bits)
job(): Random post
paragraph(): Randomly generate a paragraph
paragraphs(): Randomly generate multiple paragraphs, control the number of paragraphs through the parameter nb, and return an array
sentence(): Randomly generate a sentence
sentences(): Randomly generate multiple sentences, similar to paragraphs
text(): Randomly generate an article (don’t imagine artificial intelligence, I haven’t fully understood what a sentence means so far)
word(): Randomly generated words
words(): Randomly generate multiple words, usage and paragraphs, sentences, similar
binary(): Randomly generate binary codes
boolean():True/False
language_code(): Randomly generate two language codes
locale(): Randomly generated language/International Information
md5(): Randomly generate MD5
null_boolean():NULL/True/False
password(): Randomly generate password,Optional parameters: length: password length; special_chars: whether special characters can be used; digits: whether it contains numbers; upper_case: whether to contain uppercase letters; lower_case: whether to include lowercase letters
sha1(): Random SHA1
sha256(): Random SHA256
uuid4(): Random UUID
first_name():
first_name_female(): Female name
first_name_male(): Male name
first_romanized_name(): Roman name
last_name():
last_name_female(): Female last name
last_name_male(): Male last name
last_romanized_name():
name(): Randomly generate full name
name_female(): Male full name
name_male(): Female full name
romanized_name(): Roman name
msisdn():Mobile station international user identification code, that is, the ISDN number of the mobile user
phone_number(): Randomly generate mobile phone number
phonenumber_prefix(): Randomly generate mobile phone number segment
profile(): Randomly generate archive information
simple_profile(): Randomly generate simple file information
Specify type data:
pybool():
pydecimal():
pydict():
pyfloat(): left_digits=5 #Number of integer bits generated,
right_digits=2 #Number of decimal places generated,
positive=True #Are there only positive numbers
pyint():
pyiterable()pylist()pyset()pystr()pystruct()pytuple()ssn(): Generate ID number
chrome(): Randomly generate Chrome browser user_agent information
firefox(): Randomly generate FireFox browser user_agent information
internet_explorer(): Randomly generate IE browser user_agent information
opera(): Randomly generate Opera browser user_agent information
safari(): Randomly generate Safari browser user_agent information
linux_platform_token(): Random Linux information
user_agent(): Random user_agent information
Recommended Posts