Faker options
Example options for Faker - see this blog post
Generated: 2025-09-19T16:35:15.849752
Locales: [‘en_US’]
user_agent
android_platform_token
Type: str
Docs:
Generate an Android platform token used in user agent strings.
Example:
'Android 4.3.1'
chrome
Type: str
Docs:
Generate a Chrome web browser user agent string.
Example:
('Mozilla/5.0 (iPad; CPU iPad OS 17_2 like Mac OS X) AppleWebKit/534.2 (KHTML, like '
'Gecko) CriOS/22.0.883.0 Mobile/26G640 Safari/534.2')
firefox
Type: str
Docs:
Generate a Mozilla Firefox web browser user agent string.
Example:
('Mozilla/5.0 (Windows 98; Win 9x 4.90; sc-IT; rv:1.9.0.20) Gecko/5845-10-17 '
'07:53:08.795456 Firefox/3.6.15')
internet_explorer
Type: str
Docs:
Generate an IE web browser user agent string.
Example:
'Mozilla/5.0 (compatible; MSIE 7.0; Windows NT 6.2; Trident/4.0)'
ios_platform_token
Type: str
Docs:
Generate an iOS platform token used in user agent strings.
Example:
'iPad; CPU iPad OS 8_4_1 like Mac OS X'
linux_platform_token
Type: str
Docs:
Generate a Linux platform token used in user agent strings.
Example:
'X11; Linux x86_64'
linux_processor
Type: str
Docs:
Generate a Linux processor token used in user agent strings.
Example:
'i686'
mac_platform_token
Type: str
Docs:
Generate a MacOS platform token used in user agent strings.
Example:
'Macintosh; U; PPC Mac OS X 10_9_8'
mac_processor
Type: str
Docs:
Generate a MacOS processor token used in user agent strings.
Example:
'PPC'
opera
Type: str
Docs:
Generate an Opera web browser user agent string.
Example:
'Opera/8.12.(Windows NT 5.0; lv-LV) Presto/2.9.176 Version/11.00'
safari
Type: str
Docs:
Generate a Safari web browser user agent string.
Example:
('Mozilla/5.0 (Windows; U; Windows NT 5.01) AppleWebKit/532.32.3 (KHTML, like '
'Gecko) Version/5.1 Safari/532.32.3')
user_agent
Type: str
Docs:
Generate a random web browser user agent string.
Example:
('Mozilla/5.0 (Windows; U; Windows 95) AppleWebKit/533.3.2 (KHTML, like Gecko) '
'Version/5.0 Safari/533.3.2')
windows_platform_token
Type: str
Docs:
Generate a Windows platform token used in user agent strings.
Example:
'Windows NT 6.2'
ssn.en_US
ein
Type: str
Docs:
Generate a random United States Employer Identification Number (EIN).
An United States An Employer Identification Number (EIN) is
also known as a Federal Tax Identification Number, and is
used to identify a business entity. EINs follow a format of a
two-digit prefix followed by a hyphen and a seven-digit sequence:
##-######
https://www.irs.gov/businesses/small-businesses-self-employed/employer-id-numbers
Example:
'90-9033427'
invalid_ssn
Type: str
Docs:
Generate a random invalid United States Social Security Identification Number (SSN).
Invalid SSNs have the following characteristics:
Cannot begin with the number 9
Cannot begin with 666 in positions 1 - 3
Cannot begin with 000 in positions 1 - 3
Cannot contain 00 in positions 4 - 5
Cannot contain 0000 in positions 6 - 9
https://www.ssa.gov/kc/SSAFactSheet--IssuingSSNs.pdf
Additionally, return an invalid SSN that is NOT a valid ITIN by excluding certain ITIN related "group" values
Example:
'863-00-9628'
itin
Type: str
Docs:
Generate a random United States Individual Taxpayer Identification Number (ITIN).
An United States Individual Taxpayer Identification Number
(ITIN) is a tax processing number issued by the Internal
Revenue Service. It is a nine-digit number that always begins
with the number 9 and has a range of 70-88 in the fourth and
fifth digit. Effective April 12, 2011, the range was extended
to include 900-70-0000 through 999-88-9999, 900-90-0000
through 999-92-9999 and 900-94-0000 through 999-99-9999.
https://www.irs.gov/individuals/international-taxpayers/general-itin-information
Example:
'914-96-4641'
ssn
Type: str
Docs:
Generate a random United States Taxpayer Identification Number of the specified type.
If no type is specified, a US SSN is returned.
Example:
'528-35-2523'
sbn
sbn9
Type: str
Docs:
None
Example:
'04-144777-7'
python
enum
Type: None
Docs:
Returns a random enum of the provided input `Enum` type.
:param enum_cls: The `Enum` type to produce the value for.
:returns: A randomly selected enum value.
Example:
'No example (method has non-default args)'
pybool
Type: bool
Docs:
Generates a random boolean, optionally biased towards `True` or `False`.
:truth_probability: Probability of generating a `True` value. Must be between `0` and `100` inclusive'.
:return: Random boolean.
:raises ValueError: If invalid `truth_probability` is provided.
Example:
False
pydecimal
Type: Decimal
Docs:
None
Example:
Decimal('-9425359691953013950108178427699432135438075049222487530132307363979085404389981289258783529.53452')
pydict
Type: dict
Docs:
Returns a dictionary.
:nb_elements: number of elements for dictionary
:variable_nb_elements: is use variable number of elements for dictionary
:value_types: type of dictionary values
Example:
{ 'actually': 3157,
'energy': datetime.datetime(1985, 3, 19, 0, 54, 53, 9052),
'experience': 'http://www.carpenter.com/tags/categories/categoryprivacy.jsp',
'financial': 'ChKvBWmgLadotkBoqVJB',
'have': 'pzgWYEJbOJEOvdgXWSFS',
'more': 'EhGaqhCyLDjXsgZauiHw',
'morning': datetime.datetime(1991, 2, 27, 19, 51, 12, 623897),
'practice': 'tSpmhenaOYohCnuhWCRy'}
pyfloat
Type: float
Docs:
None
Example:
3232.99053994885
pyint
Type: int
Docs:
None
Example:
1700
pyiterable
Type: list
Docs:
None
Example:
[ 'PSkcLGbKZKAwVZkLeTmu',
1776,
Decimal('5957528760180181803287705167439834000960720424816672396841547265769062575811254864769681.1254236564875752'),
6192,
'unuZeCWwgZvsThtJawVx',
Decimal('-6065892459899392199767501407813548359206430874588416172537537270405908348263091882106760.80066213170301536784802923'),
'wShhMZSlQHQfXarAQzTb',
'http://morris.biz/mainauthor.asp',
datetime.datetime(2005, 3, 7, 9, 1, 50, 342817)]
pylist
Type: list
Docs:
None
Example:
[ 1865,
'http://hughes-jennings.info/search/blog/tagcategory.php',
Decimal('810.14762692142677380963973926547327008298826283031772379502488745'),
'[email protected]',
'https://mayer.biz/search/categories/searchindex.html',
'xVtfbpWFYTFYDpOozLrD',
'PwSMWUArfwDsyCtbOliF',
datetime.datetime(1978, 3, 7, 11, 23, 0, 713275),
'[email protected]',
'AHNeJlqiMZzISxmHdiYY',
1273918863439.43,
'RiuRmkvQYqXCTtEuAgmT',
'nPsSHEaqxfYdOvciLjrR']
pyobject
Type: NoneType
Docs:
Generates a random object passing the type desired.
:object_type: the type of the object to generate.
:return: the random object generated.
:raises ValueError: if the object type passed is not supported
Example:
None
pyset
Type: set
Docs:
None
Example:
{ datetime.datetime(1986, 4, 22, 0, 31, 50, 244063),
Decimal('-92819518685351189162482376606499539008757074426528.889486123060078938664658279344013545393279560390979'),
-783069.142146214,
884,
83176560222567.4,
'LdVUtJWnfHhuPDbqDeug',
'OhceLmDqEDUdWsYhwSZZ',
'https://www.owen.com/categories/wp-contentindex.asp',
'ivwfSTezksxOsaHuNIvz',
'tzkTguYHvJCqzdFVQaaU'}
pystr
Type: str
Docs:
Generates a random string of upper and lowercase letters.
:param min_chars: minimum length of the random part.
:param max_chars: maximum length of the random part.
:param prefix: an optional prefix to prepend to the random string.
:param suffix: an optional suffix to append to the random string.
:return: Random of random length between min and max characters.
Example:
'DLLQhnpqYHYRSFVdacFU'
pystr_format
Type: str
Docs:
None
Example:
'F0-8632983H'
pystruct
Type: tuple
Docs:
None
Example:
( [ 'https://thompson.com/exploremain.htm',
datetime.datetime(2002, 12, 11, 10, 34, 1, 905794),
'[email protected]',
'tydNimFCGFQJjFgiScVy',
'gbjGYxJGrgwzDkaTUwIF',
7863628.8907651,
datetime.datetime(1989, 10, 1, 4, 25, 38, 503687),
Decimal('447955335859746891642.5074206786951324939428275166534316632945324548682319142644738595632544754734631'),
'https://simpson.com/tagcategory.html',
'QydoDkmsnweeBdnYsNpC'],
{ 'allow': '[email protected]',
'benefit': 42706653515.8885,
'event': 65,
'feel': -60079799.183771,
'focus': datetime.datetime(1970, 3, 28, 14, 22, 28, 882429),
'follow': datetime.datetime(1996, 1, 11, 8, 45, 4, 251521),
'middle': 1576,
'page': 'http://www.davis-brown.com/tagterms.php',
'seat': 'wwftHWLzbpMIzcmokrvq',
'shake': 'VjyJBdCIKxxpCxBDGmkY'},
{ 'company': { 6: datetime.datetime(1978, 2, 7, 15, 47, 21, 794197),
7: [ 2761,
'[email protected]',
datetime.datetime(1972, 3, 10, 11, 56, 48, 431288)],
8: { 6: 8868,
7: 'wxSnkvupAgjfVSMRXkPX',
8: [ 'https://www.yoder-gonzalez.com/tagauthor.html',
'[email protected]']}},
'fly': { 9: 'xAJtrloBCjqMWoibRLID',
10: [ 'OtCjDMhMvCBhcEkSgLBP',
328,
Decimal('-674919823384148389507497301037992179546488774141001315475252056224490896565372757813396897367.2217640673364598134553393235768163961077029822272810204417543153107928')],
11: { 9: '[email protected]',
10: Decimal('-49515512917885.760197539352383450915043612844180763093748331'),
11: [7020, 'VPsJldjubXhhjUZApWuq']}},
'gun': { 3: 50786.8748278963,
4: [ '[email protected]',
Decimal('307045345315895912895206083067735605119364541329471535466189345324490318972412.1877'),
datetime.datetime(1977, 1, 1, 2, 1, 40, 330209)],
5: { 3: Decimal('818660578281336860476662331128734757832073816923657640649308490932742925460397390402798042087122.5527748647652353105717'),
4: Decimal('15277640682006524448375862837049070959.89814200390399907989221765'),
5: ['tHixYffNwLderAEujdQd', 'MlwLjKqCasbceYtfmgld']}},
'have': { 8: 'https://campos-santana.com/taglogin.htm',
9: [-384563362943.16, 'vClQSzeSphlNrAIRKCCD', -62.1938995938066],
10: { 8: -59489.52647882,
9: 'http://bryant.com/appauthor.php',
10: [ 'https://www.bennett-nguyen.com/wp-content/category/blogterms.htm',
datetime.datetime(1991, 8, 16, 14, 30, 49, 152934)]}},
'information': { 1: 'jACocROPKEmJhAVAxaPv',
2: [ 'esFUfibqIOjJEbvMcvAB',
'SJpnRcTJKAvUkkrgqrGs',
-952843.5703629],
3: { 1: 4701,
2: 'http://vargas-baker.net/blogprivacy.php',
3: [ 'PGkKOroRmoyiRPCBhUNt',
Decimal('8703518802777644159742709010237265359629666266068767862154482582.548841138775548190226072831687666954046708979990401412765040921')]}},
'much': { 7: 'iHXYgvyRrbtveawLUqjh',
8: [ 'WySPPkNujtXaVHuAZDuA',
Decimal('6642516516999975562612812009633129714187967706180223821036504379717424621327218902389467368743.7214714630243700448108135657461108379455644308415185353839025483737797194300472172716251350'),
'swhxdMCqzyPpOpajByan'],
9: { 7: Decimal('-12894113364095462781918865396310921967494683728033686549381494880081674699948191.1658150487910336820545707467699941343986995999032'),
8: datetime.datetime(2016, 10, 22, 23, 58, 55, 771781),
9: ['oyGZWtDfcvFeuXmhmmMn', 652]}},
'room': { 0: datetime.datetime(1984, 11, 3, 12, 20, 34, 924344),
1: [ 'https://www.sutton.com/categorypost.html',
-50.31859529379,
4233],
2: { 0: 'XOteToyGuWIyQhFGytXD',
1: 'http://www.robbins.com/search/wp-contentprivacy.jsp',
2: ['AghTKSHOsowbrfnJBqZl', '[email protected]']}},
'star': { 2: 5736,
3: [3858, 'UkYoHVLMSVOeJYSwjKpi', '[email protected]'],
4: { 2: 'https://www.austin.com/list/tagsregister.html',
3: 6.65742674851329,
4: ['wElJCplSPqtQOYQVlMSQ', 'dZayHaZmchtZFGjEHxYu']}},
'summer': { 4: -81195526001.8636,
5: [ '[email protected]',
7343,
Decimal('-3878037021917137852143437487660926977117901846809408630558527106514604244339215.02280176670608175346371337766929438083803938771932279740248170248055708553300904519')],
6: { 4: datetime.datetime(2025, 8, 10, 21, 56, 57, 152845),
5: 6436,
6: ['VHwdaSulNrJLUejuDLou', 'guZzwoxflngXoKnJHhzY']}},
'through': { 5: datetime.datetime(1992, 8, 10, 20, 56, 2, 926853),
6: [ 8673,
817535031.672338,
datetime.datetime(1970, 1, 23, 20, 17, 52, 645582)],
7: { 5: 6632,
6: 'IdViXoNAkhlWkQIqnjsi',
7: ['HDHqPQLEYhvAIuBBoCpB', 'nggtJqlNOhusaZdGtvqg']}}})
pytuple
Type: tuple
Docs:
None
Example:
( 'oIcSKxiCWLIAvJKqKTrQ',
'BvrWkrzoBTsPyBHwfpCA',
Decimal('-5899558813650469118558770460342650840.1'),
9295.17261843454,
6134,
'VcSdlhcZxdsmBVCznWrz',
-7758097694869.9,
'OMCAfSyfhGrYtPSPEzGw',
Decimal('6150501042116071347155331529659818085758104044730.2'),
datetime.datetime(2015, 3, 22, 23, 53, 58, 932537))
profile
profile
Type: dict
Docs:
Generates a complete profile.
If "fields" is not empty, only the fields in the list will be returned
Example:
{ 'address': '7905 Travis Ferry Suite 146\nTanyaport, LA 65426',
'birthdate': datetime.date(2024, 11, 28),
'blood_group': 'AB+',
'company': 'Avila-Baker',
'current_location': (Decimal('19.1263925'), Decimal('145.204718')),
'job': 'Animal technologist',
'mail': '[email protected]',
'name': 'Tiffany Thornton',
'residence': '07215 Jones Views Suite 411\nNew Tamaraberg, IA 69461',
'sex': 'F',
'ssn': '469-87-2476',
'username': 'mwright',
'website': [ 'http://www.goodman.com/',
'https://henry.com/',
'http://nixon.com/',
'http://www.schmidt-thomas.com/']}
simple_profile
Type: dict
Docs:
Generates a basic profile with personal information
Example:
{ 'address': '26070 James Corner Suite 293\nSmithmouth, ND 82098',
'birthdate': datetime.date(1988, 12, 30),
'mail': '[email protected]',
'name': 'Tommy Davis',
'sex': 'M',
'username': 'peggy79'}
phone_number.en_US
basic_phone_number
Type: str
Docs:
None
Example:
'3749150705'
country_calling_code
Type: str
Docs:
None
Example:
'+56'
msisdn
Type: str
Docs:
https://en.wikipedia.org/wiki/MSISDN
Example:
'3563311880029'
phone_number
Type: str
Docs:
None
Example:
'559.317.7078x2129'
person.en_US
first_name
Type: str
Docs:
None
Example:
'Anthony'
first_name_female
Type: str
Docs:
None
Example:
'Cindy'
first_name_male
Type: str
Docs:
None
Example:
'Daniel'
first_name_nonbinary
Type: str
Docs:
None
Example:
'Carla'
language_name
Type: str
Docs:
Generate a random i18n language name (e.g. English).
Example:
'Romansh'
last_name
Type: str
Docs:
None
Example:
'Johnson'
last_name_female
Type: str
Docs:
None
Example:
'Jenkins'
last_name_male
Type: str
Docs:
None
Example:
'Myers'
last_name_nonbinary
Type: str
Docs:
None
Example:
'Garcia'
name
Type: str
Docs:
:example: 'John Doe'
Example:
'Catherine Ward'
name_female
Type: str
Docs:
None
Example:
'Jessica Black'
name_male
Type: str
Docs:
None
Example:
'Paul Moore'
name_nonbinary
Type: str
Docs:
None
Example:
'John Smith'
prefix
Type: str
Docs:
None
Example:
'Mrs.'
prefix_female
Type: str
Docs:
None
Example:
'Mrs.'
prefix_male
Type: str
Docs:
None
Example:
'Dr.'
prefix_nonbinary
Type: str
Docs:
None
Example:
'Ind.'
suffix
Type: str
Docs:
None
Example:
'DDS'
suffix_female
Type: str
Docs:
None
Example:
'MD'
suffix_male
Type: str
Docs:
None
Example:
'MD'
suffix_nonbinary
Type: str
Docs:
None
Example:
'Jr.'
passport.en_US
passport_dates
Type: tuple
Docs:
Generates a formatted date of birth, issue, and expiration dates.
issue and expiration dates are conditioned to fall within U.S. standards of 5 and 10 year expirations
The ``birthday`` argument is a datetime.date object representing a date of birth.
Sources:
-https://travel.state.gov/content/travel/en/passports/passport-help/faqs.html
Example:
('19 Sep 2025', '19 Sep 2025', '19 Sep 2030')
passport_dob
Type: date
Docs:
Generate a datetime date of birth.
Example:
datetime.date(1951, 3, 1)
passport_full
Type: str
Docs:
Generates a formatted sting with US Passport information
Example:
'Michael\nOrtiz\nM\n31 Mar 1989\n25 Jun 2023\n25 Jun 2033\n722137980\n'
passport_gender
Type: str
Docs:
Generates a string representing the gender displayed on a passport
Sources:
- https://williamsinstitute.law.ucla.edu/publications/x-gender-markers-passports/
Example:
'M'
passport_number
Type: str
Docs:
Generate a passport number by replacing tokens to be alphanumeric
Example:
'H10186795'
passport_owner
Type: tuple
Docs:
Generate a given_name and surname for a passport owner
The ``gender`` argument is the gender marker of a passport owner, which is a one character string
that is either male, female, or non-binary.
Example:
('Janet', 'Barber')
misc.en_US
binary
Type: None
Docs:
Generate a random binary blob of ``length`` bytes.
If this faker instance has been seeded, performance will be signficiantly reduced, to conform
to the seeding.
:sample: length=64
Example:
'No example (output too long)'
boolean
Type: bool
Docs:
Generate a random boolean value based on ``chance_of_getting_true``.
:sample: chance_of_getting_true=25
:sample: chance_of_getting_true=50
:sample: chance_of_getting_true=75
Example:
True
csv
Type: str
Docs:
Generate random comma-separated values.
For more information on the different arguments of this method, please refer to
:meth:`dsv() <faker.providers.misc.Provider.dsv>` which is used under the hood.
:sample: data_columns=('{{name}}', '{{address}}'), num_rows=10, include_row_ids=False
:sample: header=('Name', 'Address', 'Favorite Color'),
data_columns=('{{name}}', '{{address}}', '{{safe_color_name}}'),
num_rows=10, include_row_ids=True
Example:
('"Kevin Davis","146 Tucker Station\n'
'Mooreland, PA 99642"\r\n'
'"Lori Patel","Unit 0307 Box 5065\n'
'DPO AE 78497"\r\n'
'"Matthew Saunders","8024 Janice Meadow Suite 882\n'
'New Scottstad, WV 35003"\r\n'
'"Phillip Wilson","799 Phillip Mission\n'
'Port Erictown, TN 80201"\r\n'
'"Heather Smith","2787 Daniels Islands Apt. 356\n'
'Wallaceborough, MT 52028"\r\n'
'"Kevin Larson","09046 Michael Vista\n'
'East Loganshire, SD 63280"\r\n'
'"Sarah Jensen","9576 Amanda Mill Apt. 496\n'
'West Thomas, PW 47229"\r\n'
'"Joseph Luna","991 Jessica Locks\n'
'Stevenburgh, AR 49094"\r\n'
'"Charlene Carpenter","6983 Harold Cliff Apt. 432\n'
'Emilystad, WY 17795"\r\n'
'"Ryan Sims","7106 Oconnell Glen\n'
'Lake Kylehaven, OR 10960"\r\n')
dsv
Type: str
Docs:
Generate random delimiter-separated values.
This method's behavior share some similarities with ``csv.writer``. The ``dialect`` and
``**fmtparams`` arguments are the same arguments expected by ``csv.writer`` to control its
behavior, and instead of expecting a file-like object to where output will be written, the
output is controlled by additional keyword arguments and is returned as a string.
The ``dialect`` argument defaults to ``'faker-csv'`` which is the name of a ``csv.excel``
subclass with full quoting enabled.
The ``header`` argument expects a list or a tuple of strings that will serve as the header row
if supplied. The ``data_columns`` argument expects a list or a tuple of string tokens, and these
string tokens will be passed to :meth:`pystr_format() <faker.providers.python.Provider.pystr_format>`
for data generation. Argument Groups are used to pass arguments to the provider methods.
Both ``header`` and ``data_columns`` must be of the same length.
Example:
fake.set_arguments('top_half', {'min_value': 50, 'max_value': 100})
fake.dsv(data_columns=('{{ name }}', '{{ pyint:top_half }}'))
The ``num_rows`` argument controls how many rows of data to generate, and the ``include_row_ids``
argument may be set to ``True`` to include a sequential row ID column.
:sample: dialect='excel', data_columns=('{{name}}', '{{address}}')
:sample: dialect='excel-tab', data_columns=('{{name}}', '{{address}}'), include_row_ids=True
:sample: data_columns=('{{name}}', '{{address}}'), num_rows=5, delimiter='$'
Example:
('"Mark Thomas","95894 Campbell Cliff Apt. 158\n'
'Port Samantha, AZ 71694"\r\n'
'"Jenna Richardson","4118 Ortiz Heights\n'
'North Erinland, AK 44139"\r\n'
'"Olivia Carroll","61787 Parker Lakes\n'
'Lopezfurt, OH 10809"\r\n'
'"Nicholas Webb","2366 Williams Streets\n'
'East Dalton, CO 27054"\r\n'
'"Stephen Campos","714 Roach Roads Suite 970\n'
'Port Andrea, OK 16668"\r\n'
'"Donald Thomas","30928 Martha Haven Apt. 569\n'
'Lake Jillside, GU 26936"\r\n'
'"Shannon Miller","655 Pratt Station\n'
'Port Suebury, SC 80179"\r\n'
'"Kimberly Palmer","0464 Anthony Shoal Apt. 436\n'
'Kristinamouth, NJ 30275"\r\n'
'"Cindy Kelly","USNS Mack\n'
'FPO AP 33204"\r\n'
'"Shirley Powell","904 Cochran View\n'
'Janetport, CA 82298"\r\n')
fixed_width
Type: str
Docs:
Generate random fixed width values.
Using a list of tuple records that is passed as ``data_columns``, that
defines the structure that will be generated. Arguments within the
record are provider specific, and should be a dictionary that will be
passed to the provider method.
Data Column List format
[('field width', 'definition', {'arguments'})]
The definition can be 'provider', 'provider:argument_group', tokenized
'string {{ provider:argument_group }}' that is passed to the python
provider method pystr_format() for generation, or a fixed '@word'.
Using Lists, Tuples, and Dicts as a definition for structure.
Argument Groups can be used to pass arguments to the provider methods,
but will override the arguments supplied in the tuple record.
Example:
fake.set_arguments('top_half', {'min_value': 50, 'max_value': 100})
fake.fixed_width(data_columns=[(20, 'name'), (3, 'pyint:top_half')])
:param data_columns: specification for the data structure
:type data_columns: list
:param num_rows: number of rows the generator will yield
:type num_rows: int
:param align: positioning of the value. (left, middle, right)
:type align: str
:return: Serialized Fixed Width data
:rtype: str
:sample: data_columns=[(20, 'name'), (3, 'pyint', {'min_value': 50,
'max_value': 100})], align='right', num_rows=2
Example:
('Aaron Lee 12 \n'
'William Gates 12 \n'
'Miranda Reynolds 16 \n'
'James Thomas 16 \n'
'Paul Jimenez 17 \n'
'Diane Tapia 7 \n'
'Melissa Frey 2 \n'
'Mark Howard 7 \n'
'Lisa Webster 10 \n'
'Martin Mcguire 16 ')
image
Type: None
Docs:
Generate an image and draw a random polygon on it using the Python Image Library.
Without it installed, this provider won't be functional. Returns the bytes representing
the image in a given format.
The argument ``size`` must be a 2-tuple containing (width, height) in pixels. Defaults to 256x256.
The argument ``image_format`` can be any valid format to the underlying library like ``'tiff'``,
``'jpeg'``, ``'pdf'`` or ``'png'`` (default). Note that some formats need present system libraries
prior to building the Python Image Library.
Refer to https://pillow.readthedocs.io/en/stable/handbook/image-file-formats.html for details.
The arguments ``hue`` and ``luminosity`` are the same as in the color provider and are simply forwarded to
it to generate both the background and the shape colors. Therefore, you can ask for a "dark blue" image, etc.
:sample: size=(2, 2), hue='purple', luminosity='bright', image_format='pdf'
:sample: size=(16, 16), hue=[90,270], image_format='ico'
Example:
'No example (module not found)'
json
Type: str
Docs:
Generate random JSON structure values.
Using a dictionary or list of records that is passed as ``data_columns``,
define the structure that is used to build JSON structures. For complex
data structures it is recommended to use the dictionary format.
Data Column Dictionary format:
{'key name': 'definition'}
The definition can be 'provider', 'provider:argument_group', tokenized
'string {{ provider:argument_group }}' that is passed to the python
provider method pystr_format() for generation, or a fixed '@word'.
Using Lists, Tuples, and Dicts as a definition for structure.
Example:
fake.set_arguments('top_half', {'min_value': 50, 'max_value': 100})
fake.json(data_columns={'Name': 'name', 'Score': 'pyint:top_half'})
Data Column List format:
[('key name', 'definition', {'arguments'})]
With the list format the definition can be a list of records, to create
a list within the structure data. For literal entries within the list,
set the 'field_name' to None.
:param data_columns: specification for the data structure
:type data_columns: dict
:param num_rows: number of rows the returned
:type num_rows: int
:param indent: number of spaces to indent the fields
:type indent: int
:param cls: optional json encoder to use for non-standard objects such as datetimes
:type cls: json.JSONEncoder
:return: Serialized JSON data
:rtype: str
:sample: data_columns={'Spec': '@1.0.1', 'ID': 'pyint',
'Details': {'Name': 'name', 'Address': 'address'}}, num_rows=2
:sample: data_columns={'Candidates': ['name', 'name', 'name']},
num_rows=1
:sample: data_columns=[('Name', 'name'), ('Points', 'pyint',
{'min_value': 50, 'max_value': 100})], num_rows=1
Example:
('[{"name": "Brittney Brooks", "residency": "500 Wood Stravenue\\nBarryside, MS '
'39925"}, {"name": "David Bailey", "residency": "289 Berry Squares\\nDiazhaven, CA '
'97052"}, {"name": "Rebecca Jordan", "residency": "651 Jeffrey Wall Apt. '
'049\\nWolfeburgh, MN 98678"}, {"name": "David Gomez", "residency": "86275 Laura '
'Vista Suite 988\\nMillerhaven, MD 30263"}, {"name": "Leah Ward", "residency": '
'"01520 Jennings Ways Suite 785\\nThomasstad, MD 38305"}, {"name": "Matthew Fox", '
'"residency": "899 Martinez Overpass Apt. 102\\nCharlesshire, WI 55036"}, {"name": '
'"Allen Singleton", "residency": "PSC 9523, Box 2133\\nAPO AE 80710"}, {"name": '
'"Richard Robinson", "residency": "USCGC Nguyen\\nFPO AP 27510"}, {"name": "Karen '
'Arias", "residency": "2051 Gary Park\\nWarestad, OK 09373"}, {"name": "Sandra '
'Carlson", "residency": "USNS Hancock\\nFPO AA 59669"}]')
json_bytes
Type: bytes
Docs:
Generate random JSON structure and return as bytes.
For more information on the different arguments of this method, refer to
:meth:`json() <faker.providers.misc.Provider.json>` which is used under the hood.
Example:
(b'[{"name": "Patricia Bell", "residency": "804 Kimberly Mission\\nLake Susanport, V'
b'I 44613"}, {"name": "Pamela Peterson", "residency": "37516 Oconnor Circles Suite'
b' 439\\nTeresaland, AK 46666"}, {"name": "Benjamin Collins", "residency": "5125 Mu'
b'rray Neck Apt. 313\\nSouth Martha, OK 45160"}, {"name": "Amy Ramsey", "residency"'
b': "56007 Charles Islands Suite 949\\nLeonardhaven, VA 27954"}, {"name": "Robert L'
b'ee", "residency": "18954 Houston Via\\nEast Zachary, GU 31753"}, {"name": "Amber '
b'Frye", "residency": "431 Alexis Islands\\nPort Tracychester, MT 89096"}, {"name":'
b' "Anthony Velazquez", "residency": "7302 Booth Center\\nPort Andreton, CA 31311"}'
b', {"name": "Norman Sanchez", "residency": "3196 Sampson Summit\\nEast Ronaldville'
b', ME 11273"}, {"name": "Zachary Nichols", "residency": "346 William Brooks\\nNort'
b'h Sarahborough, PR 75725"}, {"name": "Jennifer Ortiz", "residency": "35508 Cassa'
b'ndra Brooks Suite 236\\nThomasside, MT 17610"}]')
md5
Type: str
Docs:
Generate a random MD5 hash.
If ``raw_output`` is ``False`` (default), a hexadecimal string representation of the MD5 hash
will be returned. If ``True``, a ``bytes`` object representation will be returned instead.
:sample: raw_output=False
:sample: raw_output=True
Example:
'6393c942a576ba1367daff332713e553'
null_boolean
Type: NoneType
Docs:
Generate ``None``, ``True``, or ``False``, each with equal probability.
Example:
None
password
Type: str
Docs:
Generate a random password of the specified ``length``.
The arguments ``special_chars``, ``digits``, ``upper_case``, and ``lower_case`` control
what category of characters will appear in the generated password. If set to ``True``
(default), at least one character from the corresponding category is guaranteed to appear.
Special characters are characters from ``!@#$%^&*()_+``, digits are characters from
``0123456789``, and uppercase and lowercase characters are characters from the ASCII set of
letters.
:sample: length=12
:sample: length=40, special_chars=False, upper_case=False
Example:
'YdR1$2HxU$'
psv
Type: str
Docs:
Generate random pipe-separated values.
For more information on the different arguments of this method, please refer to
:meth:`dsv() <faker.providers.misc.Provider.dsv>` which is used under the hood.
:sample: data_columns=('{{name}}', '{{address}}'), num_rows=10, include_row_ids=False
:sample: header=('Name', 'Address', 'Favorite Color'),
data_columns=('{{name}}', '{{address}}', '{{safe_color_name}}'),
num_rows=10, include_row_ids=True
Example:
('"Madison Quinn"|"298 Scott View\n'
'North Ernestmouth, GA 19651"\r\n'
'"Jason Thomas"|"716 Ford Station\n'
'Robersonhaven, FM 01345"\r\n'
'"Matthew Barry"|"97629 Moody Bypass\n'
'South Catherinemouth, FL 01511"\r\n'
'"Monica Boyd"|"85541 Teresa Centers Suite 017\n'
'Lake Rachelborough, WY 10572"\r\n'
'"William Herrera"|"Unit 9364 Box 4250\n'
'DPO AP 93201"\r\n'
'"Kelli Dawson"|"7525 Smith Union\n'
'Riveratown, AL 29020"\r\n'
'"Terry Cook"|"PSC 0160, Box 1184\n'
'APO AA 95926"\r\n'
'"Cheryl Bass"|"Unit 7108 Box 5519\n'
'DPO AE 85473"\r\n'
'"Crystal Fox"|"53226 Strickland Trail\n'
'Jasonside, RI 31146"\r\n'
'"Joseph Foster"|"542 Boyd Crest Apt. 569\n'
'New Joshua, NV 41033"\r\n')
sha1
Type: str
Docs:
Generate a random SHA-1 hash.
If ``raw_output`` is ``False`` (default), a hexadecimal string representation of the SHA-1 hash
will be returned. If ``True``, a ``bytes`` object representation will be returned instead.
:sample: raw_output=False
:sample: raw_output=True
Example:
'6abea255d9efb60cef00eac8bb8b91f1e61d4957'
sha256
Type: str
Docs:
Generate a random SHA-256 hash.
If ``raw_output`` is ``False`` (default), a hexadecimal string representation of the SHA-256 hash
will be returned. If ``True``, a ``bytes`` object representation will be returned instead.
:sample: raw_output=False
:sample: raw_output=True
Example:
'b42df9975b5c0c92ee5f3c57c8adb196282a26d0ddb6dc5778b69692792e847b'
tar
Type: None
Docs:
Generate a bytes object containing a random valid tar file.
The number and sizes of files contained inside the resulting archive can be controlled
using the following arguments:
- ``uncompressed_size`` - the total size of files before compression, 16 KiB by default
- ``num_files`` - the number of files archived in resulting zip file, 1 by default
- ``min_file_size`` - the minimum size of each file before compression, 4 KiB by default
No compression is used by default, but setting ``compression`` to one of the values listed
below will use the corresponding compression type.
- ``'bzip2'`` or ``'bz2'`` for BZIP2
- ``'lzma'`` or ``'xz'`` for LZMA
- ``'gzip'`` or ``'gz'`` for GZIP
:sample: uncompressed_size=256, num_files=4, min_file_size=32
:sample: uncompressed_size=256, num_files=32, min_file_size=4, compression='bz2'
Example:
'No example (output too long)'
tsv
Type: str
Docs:
Generate random tab-separated values.
For more information on the different arguments of this method, please refer to
:meth:`dsv() <faker.providers.misc.Provider.dsv>` which is used under the hood.
:sample: data_columns=('{{name}}', '{{address}}'), num_rows=10, include_row_ids=False
:sample: header=('Name', 'Address', 'Favorite Color'),
data_columns=('{{name}}', '{{address}}', '{{safe_color_name}}'),
num_rows=10, include_row_ids=True
Example:
('"Kimberly Gutierrez"\t"665 Chan Shoals\n'
'Robertton, GU 11126"\r\n'
'"Mr. Robert Williams MD"\t"609 Steve Stravenue\n'
'South Sandraport, FM 07310"\r\n'
'"Amber Gross"\t"009 Patrick Burg Suite 429\n'
'North Kaylastad, KY 29128"\r\n'
'"Jenny Hernandez"\t"6957 Smith Keys Suite 794\n'
'Blakefurt, IL 43626"\r\n'
'"Brandon Ward"\t"7345 Scott Ferry\n'
'Port Alexander, CO 43126"\r\n'
'"Summer Tucker"\t"PSC 0439, Box 1180\n'
'APO AP 50354"\r\n'
'"Nicole Sanchez"\t"52791 Austin Plaza Suite 409\n'
'Johnstonmouth, WI 70012"\r\n'
'"Melissa Campbell"\t"Unit 6847 Box 7316\n'
'DPO AE 53472"\r\n'
'"Brandon Perez"\t"4710 Richards Freeway Suite 933\n'
'Tamaraberg, IL 10918"\r\n'
'"Raymond Nelson"\t"81434 Peterson Forks\n'
'New Mark, MN 65246"\r\n')
uuid4
Type: str
Docs:
Generate a random UUID4 object and cast it to another type if specified using a callable ``cast_to``.
By default, ``cast_to`` is set to ``str``.
May be called with ``cast_to=None`` to return a full-fledged ``UUID``.
:sample:
:sample: cast_to=None
Example:
'c3449d01-2c31-4bc2-b34d-829c87ae3261'
xml
Type: None
Docs:
Returns some XML.
:nb_elements: number of elements for dictionary
:variable_nb_elements: is use variable number of elements for dictionary
:value_types: type of dictionary values
Note: this provider required xmltodict library installed
Example:
'No example (module not found)'
zip
Type: None
Docs:
Generate a bytes object containing a random valid zip archive file.
The number and sizes of files contained inside the resulting archive can be controlled
using the following arguments:
- ``uncompressed_size`` - the total size of files before compression, 16 KiB by default
- ``num_files`` - the number of files archived in resulting zip file, 1 by default
- ``min_file_size`` - the minimum size of each file before compression, 4 KiB by default
No compression is used by default, but setting ``compression`` to one of the values listed
below will use the corresponding compression type.
- ``'bzip2'`` or ``'bz2'`` for BZIP2
- ``'lzma'`` or ``'xz'`` for LZMA
- ``'deflate'``, ``'gzip'``, or ``'gz'`` for GZIP
:sample: uncompressed_size=256, num_files=4, min_file_size=32
:sample: uncompressed_size=256, num_files=32, min_file_size=4, compression='bz2'
Example:
'No example (output too long)'
lorem.en_US
get_words_list
Type: None
Docs:
Get list of words.
``ext_word_list`` is a parameter that allows the user to provide a list
of words to be used instead of the built-in word list. If ``ext_word_list``
is provided, then the value of ``part_of_speech`` is ignored.
``part_of_speech`` is a parameter that defines to what part of speech
the returned word belongs. If ``ext_word_list`` is not ``None``, then
``part_of_speech`` is ignored. If the value of ``part_of_speech`` does
not correspond to an existent part of speech according to the set locale,
then an exception is raised.
:sample: part_of_speech="abc", ext_word_list=['abc', 'def', 'ghi', 'jkl']
:sample: part_of_speech="abc"
:sample: ext_word_list=['abc', 'def', 'ghi', 'jkl']
.. warning::
Depending on the length of a locale provider's built-in word list or
on the length of ``ext_word_list`` if provided, a large ``nb`` can
exhaust said lists if ``unique`` is ``True``, raising an exception.
Example:
'No example (output too long)'
paragraph
Type: str
Docs:
Generate a paragraph.
The ``nb_sentences`` argument controls how many sentences the paragraph
will contain, and setting ``variable_nb_sentences`` to ``False`` will
generate the exact amount, while setting it to ``True`` (default) will
generate a random amount (+/-40%, minimum of 1) using
|randomize_nb_elements|.
Under the hood, |sentences| is used to generate the sentences, so the
argument ``ext_word_list`` works in the same way here as it would in
that method.
:sample: nb_sentences=5
:sample: nb_sentences=5, variable_nb_sentences=False
:sample: nb_sentences=5, ext_word_list=['abc', 'def', 'ghi', 'jkl']
:sample: nb_sentences=5, variable_nb_sentences=False,
ext_word_list=['abc', 'def', 'ghi', 'jkl']
Example:
('Boy event each sometimes church. Customer seem star let. Program conference trial '
'inside stuff. Right order identify so.')
paragraphs
Type: list
Docs:
Generate a list of paragraphs.
This method uses |paragraph| under the hood to generate paragraphs, and
the ``nb`` argument controls exactly how many sentences the list will
contain. The ``ext_word_list`` argument works in exactly the same way
as well.
:sample: nb=5
:sample: nb=5, ext_word_list=['abc', 'def', 'ghi', 'jkl']
Example:
[ 'Close go support interesting southern seek. Better operation personal. Often '
'particular life treat run.',
'Kid develop truth key land. Animal catch born friend understand wear start. '
'Whose idea say age even continue.',
'Purpose couple eye daughter become east marriage.']
sentence
Type: str
Docs:
Generate a sentence.
The ``nb_words`` argument controls how many words the sentence will
contain, and setting ``variable_nb_words`` to ``False`` will generate
the exact amount, while setting it to ``True`` (default) will generate
a random amount (+/-40%, minimum of 1) using |randomize_nb_elements|.
Under the hood, |words| is used to generate the words, so the argument
``ext_word_list`` works in the same way here as it would in that method.
:sample: nb_words=10
:sample: nb_words=10, variable_nb_words=False
:sample: nb_words=10, ext_word_list=['abc', 'def', 'ghi', 'jkl']
:sample: nb_words=10, variable_nb_words=True,
ext_word_list=['abc', 'def', 'ghi', 'jkl']
Example:
'Anything recently quickly.'
sentences
Type: list
Docs:
Generate a list of sentences.
This method uses |sentence| under the hood to generate sentences, and
the ``nb`` argument controls exactly how many sentences the list will
contain. The ``ext_word_list`` argument works in exactly the same way
as well.
:sample:
:sample: nb=5
:sample: nb=5, ext_word_list=['abc', 'def', 'ghi', 'jkl']
Example:
[ 'Federal if happy parent ground.',
'Successful cup hair care rock suffer.',
'Red current sea check.']
text
Type: str
Docs:
Generate a text string.
The ``max_nb_chars`` argument controls the approximate number of
characters the text string will have, and depending on its value, this
method may use either |words|, |sentences|, or |paragraphs| for text
generation. The ``ext_word_list`` argument works in exactly the same way
it would in any of those methods.
:sample: max_nb_chars=20
:sample: max_nb_chars=80
:sample: max_nb_chars=160
:sample: ext_word_list=['abc', 'def', 'ghi', 'jkl']
Example:
('Already specific also break tax. Natural throw anyone section board threat.\n'
'Probably reduce thousand bag than thing and. Spend heart so later. Security test '
'every must.')
texts
Type: list
Docs:
Generate a list of text strings.
The ``nb_texts`` argument controls how many text strings the list will
contain, and this method uses |text| under the hood for text generation,
so the two remaining arguments, ``max_nb_chars`` and ``ext_word_list``
will work in exactly the same way as well.
:sample: nb_texts=5
:sample: nb_texts=5, max_nb_chars=50
:sample: nb_texts=5, max_nb_chars=50,
ext_word_list=['abc', 'def', 'ghi', 'jkl']
Example:
[ 'Present international watch various believe worry second. Physical accept save '
'tough red bit.\n'
'Man cause out red nothing admit scientist. Painting any whose.',
'Make history vote day stay pay just drop. Very child ability good.',
'Enough wear bed defense range movement. Board possible term think miss away '
'mouth. Yeah treatment crime.\n'
'Though ground common life tax. Huge include happy election discussion.']
word
Type: str
Docs:
Generate a word.
This method uses |words| under the hood with the ``nb`` argument set to
``1`` to generate the result.
:sample:
:sample: ext_word_list=['abc', 'def', 'ghi', 'jkl']
Example:
'ever'
words
Type: list
Docs:
Generate a tuple of words.
The ``nb`` argument controls the number of words in the resulting list,
and if ``ext_word_list`` is provided, words from that list will be used
instead of those from the locale provider's built-in word list.
if ``word_list`` is not provided, the method will use a default value of None,
which will result in the method calling the ``get_words_list`` method to get the
word list. If ``word_list`` is provided, the method will use the provided list.
If ``unique`` is ``True``, this method will return a list containing
unique words. Under the hood, |random_sample| will be used for sampling
without replacement. If ``unique`` is ``False``, |random_choices| is
used instead, and the list returned may contain duplicates.
:sample:
:sample: nb=5
:sample: nb=5, ext_word_list=['abc', 'def', 'ghi', 'jkl']
:sample: nb=4, ext_word_list=['abc', 'def', 'ghi', 'jkl'], unique=True
Example:
['total', 'attorney', 'yes']
job.en_US
job
Type: str
Docs:
None
Example:
'Engineer, materials'
job_female
Type: str
Docs:
None
Example:
'Scientist, research (maths)'
job_male
Type: str
Docs:
None
Example:
'Radiation protection practitioner'
isbn.en_US
isbn10
Type: str
Docs:
:sample:
Example:
'1-268-27081-4'
isbn13
Type: str
Docs:
:sample:
Example:
'978-1-85619-089-3'
internet.en_US
ascii_company_email
Type: None
Docs:
None
Example:
'No example (method has non-default args)'
ascii_email
Type: None
Docs:
None
Example:
'No example (method has non-default args)'
ascii_free_email
Type: None
Docs:
None
Example:
'No example (method has non-default args)'
ascii_safe_email
Type: None
Docs:
None
Example:
'No example (method has non-default args)'
company_email
Type: None
Docs:
None
Example:
'No example (method has non-default args)'
dga
Type: str
Docs:
Generates a domain name by given date
https://en.wikipedia.org/wiki/Domain_generation_algorithm
:type year: int
:type month: int
:type day: int
:type tld: str
:type length: int
:rtype: str
Example:
'vxjesdqfmlgmiuaraepbrdasiurqilkhuogqtoaryoe.info'
domain_name
Type: None
Docs:
Produce an Internet domain name with the specified number of
subdomain levels.
>>> domain_name()
nichols-phillips.com
>>> domain_name(2)
williamson-hopkins.jackson.com
Example:
'No example (method has non-default args)'
domain_word
Type: None
Docs:
None
Example:
'No example (method has non-default args)'
Type: None
Docs:
None
Example:
'No example (method has non-default args)'
free_email
Type: None
Docs:
None
Example:
'No example (method has non-default args)'
free_email_domain
Type: None
Docs:
None
Example:
'No example (method has non-default args)'
hostname
Type: None
Docs:
Produce a hostname with specified number of subdomain levels.
>>> hostname()
db-01.nichols-phillips.com
>>> hostname(0)
laptop-56
>>> hostname(2)
web-12.williamson-hopkins.jackson.com
Example:
'No example (method has non-default args)'
http_method
Type: str
Docs:
Returns random HTTP method
https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods
:rtype: str
Example:
'POST'
http_status_code
Type: int
Docs:
Returns random HTTP status code
https://www.rfc-editor.org/rfc/rfc9110#name-status-codes
:param include_unassigned: Whether to include status codes which have
not yet been assigned or are unused
:return: a random three digit status code
:rtype: int
:example: 404
Example:
322
iana_id
Type: str
Docs:
Returns IANA Registrar ID
https://www.iana.org/assignments/registrar-ids/registrar-ids.xhtml
:rtype: str
Example:
'4681517'
image_url
Type: str
Docs:
Returns URL to placeholder image
Example: http://placehold.it/640x480
:param width: Optional image width
:param height: Optional image height
:param placeholder_url: Optional template string of image URLs from custom
placeholder service. String must contain ``{width}`` and ``{height}``
placeholders, eg: ``https:/example.com/{width}/{height}``.
:rtype: str
Example:
'https://dummyimage.com/1023x950'
ipv4
Type: str
Docs:
Returns a random IPv4 address or network with a valid CIDR.
:param network: Network address
:param address_class: IPv4 address class (a, b, or c)
:param private: Public or private
:returns: IPv4
Example:
'205.248.85.233'
ipv4_network_class
Type: str
Docs:
Returns a IPv4 network class 'a', 'b' or 'c'.
:returns: IPv4 network class
Example:
'c'
ipv4_private
Type: str
Docs:
Returns a private IPv4.
:param network: Network address
:param address_class: IPv4 address class (a, b, or c)
:returns: Private IPv4
Example:
'172.27.178.34'
ipv4_public
Type: str
Docs:
Returns a public IPv4 excluding private blocks.
:param network: Network address
:param address_class: IPv4 address class (a, b, or c)
:returns: Public IPv4
Example:
'191.118.0.43'
ipv6
Type: str
Docs:
Produce a random IPv6 address or network with a valid CIDR
Example:
'901e:be41:1bde:f612:4b43:2236:3205:63b9'
mac_address
Type: str
Docs:
Returns a random MAC address.
:param multicast: Multicast address
:returns: MAC Address
Example:
'6e:88:0f:59:b0:f6'
nic_handle
Type: str
Docs:
Returns NIC Handle ID
https://www.apnic.net/manage-ip/using-whois/guide/person/
:rtype: str
Example:
'UM198-FAKE'
nic_handles
Type: list
Docs:
Returns NIC Handle ID list
:rtype: list[str]
Example:
['QHS34214-FYPX']
port_number
Type: int
Docs:
Returns a network port number
https://tools.ietf.org/html/rfc6335
:param is_system: System or well-known ports
:param is_user: User or registered ports
:param is_dynamic: Dynamic / private / ephemeral ports
:rtype: int
Example:
2415
ripe_id
Type: str
Docs:
Returns RIPE Organization ID
https://www.ripe.net/manage-ips-and-asns/db/support/organisation-object-in-the-ripe-database
:rtype: str
Example:
'ORG-MYH9-RIPE'
safe_domain_name
Type: None
Docs:
None
Example:
'No example (method has non-default args)'
safe_email
Type: None
Docs:
None
Example:
'No example (method has non-default args)'
slug
Type: None
Docs:
Django algorithm
Example:
'No example (method has non-default args)'
tld
Type: str
Docs:
None
Example:
'info'
uri
Type: str
Docs:
:param schemes: a list of strings to use as schemes, one will chosen randomly.
If None, it will generate http and https uris.
Passing an empty list will result in schemeless uri generation like "://domain.com/index.html".
:param deep: an integer specifying how many path components the URI should have..
:return: a random url string.
Example:
'http://friedman.com/search/list/categoryregister.html'
uri_extension
Type: str
Docs:
None
Example:
'.html'
uri_page
Type: str
Docs:
None
Example:
'category'
uri_path
Type: str
Docs:
None
Example:
'search/explore/category'
url
Type: str
Docs:
:param schemes: a list of strings to use as schemes, one will chosen randomly.
If None, it will generate http and https urls.
Passing an empty list will result in schemeless url generation like "://domain.com".
:return: a random url string.
Example:
'https://www.jackson.com/'
user_name
Type: None
Docs:
None
Example:
'No example (method has non-default args)'
geo.en_US
coordinate
Type: Decimal
Docs:
Optionally center the coord and pick a point within radius.
Example:
Decimal('-32.846246')
latitude
Type: Decimal
Docs:
None
Example:
Decimal('65.8104575')
latlng
Type: tuple
Docs:
None
Example:
(Decimal('-36.610139'), Decimal('82.451489'))
local_latlng
Type: tuple
Docs:
Returns a location known to exist on land in a country specified by `country_code`.
Defaults to 'en_US'. See the `land_coords` list for available locations/countries.
Example:
('42.97086', '-82.42491', 'Port Huron', 'US', 'America/Detroit')
location_on_land
Type: tuple
Docs:
Returns a random tuple specifying a coordinate set guaranteed to exist on land.
Format is `(latitude, longitude, place name, two-letter country code, timezone)`
Pass `coords_only` to return coordinates without metadata.
Example:
('25.49043', '85.94001', 'Teghra', 'IN', 'Asia/Kolkata')
longitude
Type: Decimal
Docs:
None
Example:
Decimal('-46.285390')
file
file_extension
Type: str
Docs:
Generate a file extension under the specified ``category``.
If ``category`` is ``None``, a random category will be used. The list of
valid categories include: ``'audio'``, ``'image'``, ``'office'``,
``'text'``, and ``'video'``.
:sample:
:sample: category='image'
Example:
'avi'
file_name
Type: str
Docs:
Generate a random file name with extension.
If ``extension`` is ``None``, a random extension will be created
under the hood using |file_extension| with the specified
``category``. If a value for ``extension`` is provided, the
value will be used instead, and ``category`` will be ignored.
The actual name part itself is generated using |word|. If
extension is an empty string then no extension will be added,
and file_name will be the same as |word|.
:sample: size=10
:sample: category='audio'
:sample: extension='abcdef'
:sample: category='audio', extension='abcdef'
:sample: extension=''
Example:
'security.pages'
file_path
Type: str
Docs:
Generate an pathname to a file.
This method uses |file_name| under the hood to generate the file
name itself, and ``depth`` controls the depth of the directory
path, and |word| is used under the hood to generate the
different directory names.
If ``absolute`` is ``True`` (default), the generated path starts
with ``/`` and is absolute. Otherwise, the generated path is
relative.
If used, ``extension`` can be either a string, forcing that
extension, a sequence of strings (one will be picked at random),
or an empty sequence (the path will have no extension). Default
behaviour is the same as |file_name|
if ``file_system`` is set (default="linux"), the generated path uses
specified file system path standard, the list of valid file systems include:
``'windows'``, ``'linux'``.
:sample: size=10
:sample: depth=3
:sample: depth=5, category='video'
:sample: depth=5, category='video', extension='abcdef'
:sample: extension=[]
:sample: extension=''
:sample: extension=["a", "bc", "def"]
:sample: depth=5, category='video', extension='abcdef', file_system='windows'
Example:
'/both/so.webm'
mime_type
Type: str
Docs:
Generate a mime type under the specified ``category``.
If ``category`` is ``None``, a random category will be used. The list of
valid categories include ``'application'``, ``'audio'``, ``'image'``,
``'message'``, ``'model'``, ``'multipart'``, ``'text'``, and
``'video'``.
:sample:
:sample: category='application'
Example:
'audio/vnd.rn-realaudio'
unix_device
Type: str
Docs:
Generate a Unix device file name.
If ``prefix`` is ``None``, a random prefix will be used. The list of
valid prefixes include: ``'sd'``, ``'vd'``, and ``'xvd'``.
:sample:
:sample: prefix='mmcblk'
Example:
'/dev/vdc'
unix_partition
Type: str
Docs:
Generate a Unix partition name.
This method uses |unix_device| under the hood to create a device file
name with the specified ``prefix``.
:sample:
:sample: prefix='mmcblk'
Example:
'/dev/vdv7'
emoji
emoji
Type: str
Docs:
:example: '😉'
Example:
'🧛🏻\u200d♂️'
doi
doi
Type: str
Docs:
Generate a valid Digital Object Identifier (DOI).
Format: 10.{4-9 digits}/{alphanumeric string}
Eg: 10.1000/xyz123
:sample:
Example:
'10.26511520/v4m5b04'
date_time.en_US
am_pm
Type: str
Docs:
:sample:
Example:
'PM'
century
Type: str
Docs:
:sample:
Example:
'XVI'
date
Type: str
Docs:
Get a date string between January 1, 1970 and now.
:param pattern: Format of the date (year-month-day by default)
:param end_datetime: A ``DateParseType``. Defaults to the current date and time
:sample:
:sample: pattern='%m/%d/%Y'
:sample: end_datetime='+1w'
Example:
'2013-01-25'
date_between
Type: date
Docs:
Get a Date object based on a random date between two given dates.
Accepts date strings that can be recognized by strtotime().
:param start_date: A ``DateParseType``. Defaults to 30 years ago
:param end_date: A ``DateParseType``. Defaults to ``"today"``
:sample:
:sample: start_date='-1w'
:sample: start_date="-1y", end_date="+1w"
Example:
datetime.date(2022, 3, 27)
date_between_dates
Type: date
Docs:
Get a random date between the two given dates.
:param date_start: A ``DateParseType``. Defaults to the UNIX epoch
:param date_end: A ``DateParseType``. Defaults to the current date and time
:sample:
Example:
datetime.date(2025, 9, 19)
date_object
Type: date
Docs:
Get a date object between January 1, 1970 and now
:param end_datetime: A ``DateParseType``. Defaults to the current date and time
:sample:
:sample: end_datetime='+1w'
Example:
datetime.date(2015, 11, 16)
date_of_birth
Type: date
Docs:
Generate a random date of birth represented as a Date object,
constrained by optional miminimum_age and maximum_age
parameters.
:param tzinfo: Defaults to None.
:param minimum_age: Defaults to ``0``.
:param maximum_age: Defaults to ``115``.
:sample:
:sample: minimum_age=30, maximum_age=50
Example:
datetime.date(1938, 3, 4)
date_this_century
Type: date
Docs:
Gets a Date object for the current century.
:param before_today: include days in current century before today. Defaults to True
:param after_today: include days in current century after today. Defaults to False
:sample:
:sample: before_today=False, after_today=True
Example:
datetime.date(2016, 7, 13)
date_this_decade
Type: date
Docs:
Gets a Date object for the decade year.
:param before_today: include days in current decade before today. Defaults to True
:param after_today: include days in current decade after today. Defaults to False
:sample:
:sample: before_today=False, after_today=True
Example:
datetime.date(2020, 12, 10)
date_this_month
Type: date
Docs:
Gets a Date object for the current month.
:param before_today: include days in current month before today. Defaults to True
:param after_today: include days in current month after today. Defaults to False
:sample:
:sample: before_today=False, after_today=True
Example:
datetime.date(2025, 9, 4)
date_this_year
Type: date
Docs:
Gets a Date object for the current year.
:param before_today: include days in current year before today. Defaults to True
:param after_today: include days in current year after today. Defaults to False
:sample:
:sample: before_today=False, after_today=True
Example:
datetime.date(2025, 3, 23)
date_time
Type: datetime
Docs:
Get a datetime object for a date between January 1, 1970 and a specified end_datetime
:param tzinfo: timezone, instance of datetime.tzinfo subclass
:param end_datetime: A ``DateParseType``. Defaults to the current date and time
:sample:
Example:
datetime.datetime(1971, 1, 14, 18, 52, 14, 799903)
date_time_ad
Type: datetime
Docs:
Get a datetime object for a date between January 1, 0001 and now
:param tzinfo: timezone, instance of datetime.tzinfo subclass
:param end_datetime: A ``DateParseType``. Defaults to the current date and time
:param start_datetime: A ``DateParseType``. Defaults to UNIX timestamp ``-62135596800``,
equivalent to 0001-01-01 00:00:00 UTC
:sample:
Example:
datetime.datetime(20, 2, 22, 11, 5, 51, 125298)
date_time_between
Type: datetime
Docs:
Get a datetime object based on a random date between two given dates.
Accepts date strings that can be recognized by strtotime().
:param start_date: A ``DateParseType``. Defaults to 30 years ago
:param end_date: A ``DateParseType``. Defaults to ``"now"``
:param tzinfo: timezone, instance of datetime.tzinfo subclass
:sample:
Example:
datetime.datetime(2006, 9, 6, 4, 10, 9, 934882)
date_time_between_dates
Type: datetime
Docs:
Get a random datetime between the two given datetimes.
:param datetime_start: A ``DateParseType``. Defaults to the UNIX epoch
:param datetime_end: A ``DateParseType``. Defaults to the current date and time
:param tzinfo: timezone, instance of datetime.tzinfo subclass
:sample:
:sample: datetime_start='-30y', datetime_end='now'
:sample: datetime_start='now', datetime_end='+1y'
Example:
datetime.datetime(2025, 9, 19, 16, 35, 15)
date_time_this_century
Type: datetime
Docs:
Gets a datetime object for the current century.
:param before_now: include days in current century before today. Defaults to True
:param after_now: include days in current century after today. Defaults to False
:param tzinfo: timezone, instance of datetime.tzinfo subclass
:sample:
:sample: before_now=False, after_now=True
Example:
datetime.datetime(2014, 7, 7, 6, 27, 45, 914660)
date_time_this_decade
Type: datetime
Docs:
Gets a datetime object for the decade year.
:param before_now: include days in current decade before today. Defaults to True
:param after_now: include days in current decade after today. Defaults to False
:param tzinfo: timezone, instance of datetime.tzinfo subclass
:sample:
:sample: before_now=False, after_now=True
Example:
datetime.datetime(2022, 4, 16, 16, 5, 0, 325595)
date_time_this_month
Type: datetime
Docs:
Gets a datetime object for the current month.
:param before_now: include days in current month before today. Defaults to True
:param after_now: include days in current month after today. Defaults to False
:param tzinfo: timezone, instance of datetime.tzinfo subclass
:sample:
:sample: before_now=False, after_now=True
Example:
datetime.datetime(2025, 9, 13, 15, 54, 58, 967748)
date_time_this_year
Type: datetime
Docs:
Gets a datetime object for the current year.
:param before_now: include days in current year before today. Defaults to True
:param after_now: include days in current year after today. Defaults to False
:param tzinfo: timezone, instance of datetime.tzinfo subclass
:sample:
:sample: before_now=False, after_now=True
Example:
datetime.datetime(2025, 5, 19, 15, 55, 11, 819406)
day_of_month
Type: str
Docs:
:sample:
Example:
'26'
day_of_week
Type: str
Docs:
:sample:
Example:
'Sunday'
future_date
Type: date
Docs:
Get a Date object based on a random date between 1 day from now and a
given date.
:param end_date: A ``DateParseType``. Defaults to ``"+30d"``
:param tzinfo: timezone, instance of datetime.tzinfo subclass
:sample:
:sample: end_date='+1y'
Example:
datetime.date(2025, 10, 8)
future_datetime
Type: datetime
Docs:
Get a datetime object based on a random date between 1 second form now
and a given date.
:param end_date: A ``DateParseType``. Defaults to ``"+30d"``
:param tzinfo: timezone, instance of datetime.tzinfo subclass
:sample:
:sample: end_date='+1y'
Example:
datetime.datetime(2025, 10, 6, 21, 19, 15, 166979)
iso8601
Type: str
Docs:
Get an ISO 8601 string for a datetime between the UNIX epoch and now.
:param tzinfo: timezone, instance of datetime.tzinfo subclass
:param end_datetime: A ``DateParseType``. Defaults to the current date and time
:param sep: separator between date and time, defaults to 'T'
:param timespec: format specifier for the time part, defaults to 'auto' - see datetime.isoformat() documentation
:sample:
Example:
'2006-12-26T08:17:10.813482'
month
Type: str
Docs:
:sample:
Example:
'01'
month_name
Type: str
Docs:
:sample:
Example:
'July'
past_date
Type: date
Docs:
Get a Date object based on a random date between a given date and 1 day
ago.
:param start_date: A ``DateParseType``. Defaults to ``"-30d"``
:param tzinfo: timezone, instance of datetime.tzinfo subclass
:sample:
:sample: start_date='-1y'
Example:
datetime.date(2025, 9, 14)
past_datetime
Type: datetime
Docs:
Get a datetime object based on a random date between a given date and 1
second ago.
:param start_date: A ``DateParseType``. Defaults to ``"-30d"``
:param tzinfo: timezone, instance of datetime.tzinfo subclass
:example: datetime('1999-02-02 11:42:52')
:sample:
:sample: end_date='+1y'
Example:
datetime.datetime(2025, 9, 11, 15, 4, 2, 433478)
pytimezone
Type: ZoneInfo
Docs:
Generate a random timezone (see ``faker.timezone`` for any args)
and return a Python object usable as a ``tzinfo`` for ``datetime``
or other fakers.
:sample:
Example:
zoneinfo.ZoneInfo(key='Asia/Riyadh')
time
Type: str
Docs:
Get a time string (24h format by default)
:param pattern: format
:param end_datetime: A ``DateParseType``. Defaults to the current date and time
:sample:
:sample: pattern='%I:%M %p'
Example:
'07:47:42'
time_delta
Type: timedelta
Docs:
Get a random timedelta object of duration between the current date and time and `end_datetime`
:param end_datetime: A ``DateParseType``. Defaults to the current date and time
:sample:
:sample: end_datetime='+30h'
Example:
datetime.timedelta(0)
time_object
Type: time
Docs:
Get a time object
:param end_datetime: A ``DateParseType``. Defaults to the current date and time
:sample:
:sample: end_datetime='+1h'
Example:
datetime.time(19, 25, 32, 228168)
time_series
Type: generator
Docs:
Returns a generator yielding tuples of ``(<datetime>, <value>)``.
The data points will start at ``start_date``, and be at every time interval specified by
``precision``.
:param start_date: A ``DateParseType``. Defaults to ``"-30d"``
:param end_date: A ``DateParseType``. Defaults to ``"now"``
:param precision: A float representing the time interval between data points.
Defaults to 1/30th of the time
:param distrib: A callable that accepts a datetime object and returns a value.
Defaults to a uniform distribution
:param tzinfo: timezone, instance of datetime.tzinfo subclass
:sample:
Example:
<generator object Provider.time_series at 0x7fc744b5fbe0>
timezone
Type: str
Docs:
:sample:
Example:
'Asia/Dubai'
unix_time
Type: float
Docs:
Get a timestamp between January 1, 1970 and now, unless passed
explicit ``start_datetime`` or `end_datetime` values.
On Windows, the decimal part is always 0.
:param end_datetime: A ``DateParseType``. Defaults to the UNIX epoch
:param start_datetime: A ``DateParseType``. Defaults to the current date and time
:sample:
Example:
695758439.7571584
year
Type: str
Docs:
:sample:
Example:
'1972'
currency.en_US
cryptocurrency
Type: tuple
Docs:
None
Example:
('POT', 'PotCoin')
cryptocurrency_code
Type: str
Docs:
None
Example:
'EOS'
cryptocurrency_name
Type: str
Docs:
None
Example:
'Bitcoin Cash'
currency
Type: tuple
Docs:
None
Example:
('COP', 'Colombian peso')
currency_code
Type: str
Docs:
None
Example:
'CUP'
currency_name
Type: str
Docs:
None
Example:
'Zimbabwean dollar'
currency_symbol
Type: str
Docs:
:example: $
Example:
'Ar'
pricetag
Type: str
Docs:
None
Example:
'$5.35'
credit_card.en_US
credit_card_expire
Type: str
Docs:
Generate a credit card expiry date.
This method uses |date_time_between| under the hood to generate the
expiry date, so the ``start`` and ``end`` arguments work in the same way
here as it would in that method. For the actual formatting of the expiry
date, |strftime| is used and ``date_format`` is simply passed
to that method.
Example:
'04/30'
credit_card_full
Type: str
Docs:
Generate a set of credit card details.
Example:
'VISA 16 digit\nJason Ferguson\n4219519790025298 08/28\nCVC: 481\n'
credit_card_number
Type: str
Docs:
Generate a valid credit card number.
Example:
'6011879488130619'
credit_card_provider
Type: str
Docs:
Generate a credit card provider name.
Example:
'Maestro'
credit_card_security_code
Type: str
Docs:
Generate a credit card security code.
Example:
'742'
company.en_US
bs
Type: str
Docs:
:example: 'integrate extensible convergence'
Example:
'repurpose robust relationships'
catch_phrase
Type: str
Docs:
:example: 'Robust full-range hub'
Example:
'Function-based neutral projection'
company
Type: str
Docs:
:example: 'Acme Ltd'
Example:
'Decker, Graham and Payne'
company_suffix
Type: str
Docs:
:example: 'Ltd'
Example:
'Ltd'
color.en_US
color
Type: str
Docs:
Generate a color in a human-friendly way.
Under the hood, this method first creates a color represented in the HSV
color model and then converts it to the desired ``color_format``. The
argument ``hue`` controls the H value according to the following
rules:
- If the value is a number from ``0`` to ``360``, it will serve as the H
value of the generated color.
- If the value is a tuple/list of 2 numbers from 0 to 360, the color's H
value will be randomly selected from that range.
- If the value is a valid string, the color's H value will be randomly
selected from the H range corresponding to the supplied string. Valid
values are ``'monochrome'``, ``'red'``, ``'orange'``, ``'yellow'``,
``'green'``, ``'blue'``, ``'purple'``, and ``'pink'``.
The argument ``luminosity`` influences both S and V values and is
partially affected by ``hue`` as well. The finer details of this
relationship are somewhat involved, so please refer to the source code
instead if you wish to dig deeper. To keep the interface simple, this
argument either can be omitted or can accept the following string
values:``'bright'``, ``'dark'``, ``'light'``, or ``'random'``.
The argument ``color_format`` controls in which color model the color is
represented. Valid values are ``'hsv'``, ``'hsl'``, ``'rgb'``, or
``'hex'`` (default).
:sample: hue='red'
:sample: luminosity='light'
:sample: hue=(100, 200), color_format='rgb'
:sample: hue='orange', luminosity='bright'
:sample: hue=135, luminosity='dark', color_format='hsv'
:sample: hue=(300, 20), luminosity='random', color_format='hsl'
Example:
'#f9d9b1'
color_hsl
Type: tuple
Docs:
Generate a HSL color tuple.
:sample:
:sample: hue='red', luminosity='dark'
:sample: hue=(100, 200), luminosity='random'
Example:
(73, 100, 29)
color_hsv
Type: tuple
Docs:
Generate a HSV color tuple.
:sample:
:sample: hue='red', luminosity='dark'
:sample: hue=(100, 200), luminosity='random'
Example:
(180, 85, 95)
color_name
Type: str
Docs:
Generate a color name.
:sample:
Example:
'Navy'
color_rgb
Type: tuple
Docs:
Generate a RGB color tuple of integers.
:sample:
:sample: hue='red', luminosity='dark'
:sample: hue=(100, 200), luminosity='random'
Example:
(72, 69, 211)
color_rgb_float
Type: tuple
Docs:
Generate a RGB color tuple of floats.
:sample:
:sample: hue='red', luminosity='dark'
:sample: hue=(100, 200), luminosity='random'
Example:
(0.5738700000000002, 0.5546000000000001, 0.94)
hex_color
Type: str
Docs:
Generate a color formatted as a hex triplet.
:sample:
Example:
'#e6eb75'
rgb_color
Type: str
Docs:
Generate a color formatted as a comma-separated RGB value.
:sample:
Example:
'36,9,190'
rgb_css_color
Type: str
Docs:
Generate a color formatted as a CSS rgb() function.
:sample:
Example:
'rgb(231,95,103)'
safe_color_name
Type: str
Docs:
Generate a web-safe color name.
:sample:
Example:
'olive'
safe_hex_color
Type: str
Docs:
Generate a web-safe color formatted as a hex triplet.
:sample:
Example:
'#9977ee'
barcode.en_US
ean
Type: str
Docs:
Generate an EAN barcode of the specified ``length``.
The value of ``length`` can only be ``8`` or ``13`` (default) which will
create an EAN-8 or an EAN-13 barcode respectively.
If a value for ``prefixes`` is specified, the result will begin with one
of the sequences in ``prefixes``.
:sample: length=13
:sample: length=8
:sample: prefixes=('00',)
:sample: prefixes=('45', '49')
Example:
'5709595494557'
ean13
Type: str
Docs:
Generate an EAN-13 barcode.
If ``leading_zero`` is ``True``, the leftmost digit of the barcode will
be set to ``0``. If ``False``, the leftmost digit cannot be ``0``. If
``None`` (default), the leftmost digit can be any digit.
If a value for ``prefixes`` is specified, the result will begin with one
of the sequences in ``prefixes`` and will ignore ``leading_zero``.
This method uses the standard barcode provider's |ean13| under the
hood with the ``prefixes`` argument set to the correct value to attain
the behavior described above.
.. note::
EAN-13 barcode that starts with a zero can be converted to UPC-A
by dropping the leading zero. This may cause problems with readers
that treat all of these code as UPC-A codes and drop the first digit
when reading it.
You can set the argument ``prefixes`` ( or ``leading_zero`` for
convenience) explicitly to avoid or to force the generated barcode to
start with a zero. You can also generate actual UPC-A barcode with
|EnUsBarcodeProvider.upc_a|.
:sample:
:sample: leading_zero=False
:sample: leading_zero=True
:sample: prefixes=('00',)
:sample: prefixes=('45', '49')
Example:
'2878372063590'
ean8
Type: str
Docs:
Generate an EAN-8 barcode.
This method uses |ean| under the hood with the ``length`` argument
explicitly set to ``8``.
If a value for ``prefixes`` is specified, the result will begin with one
of the sequences in ``prefixes``.
:sample:
:sample: prefixes=('00',)
:sample: prefixes=('45', '49')
Example:
'02425191'
localized_ean
Type: str
Docs:
Generate a localized EAN barcode of the specified ``length``.
The value of ``length`` can only be ``8`` or ``13`` (default) which will
create an EAN-8 or an EAN-13 barcode respectively.
This method uses the standard barcode provider's |ean| under the hood
with the ``prefixes`` argument explicitly set to ``local_prefixes`` of
a localized barcode provider implementation.
:sample:
:sample: length=13
:sample: length=8
Example:
'0170764704756'
localized_ean13
Type: str
Docs:
Generate a localized EAN-13 barcode.
This method uses |localized_ean| under the hood with the ``length``
argument explicitly set to ``13``.
Example:
'0239710306885'
localized_ean8
Type: str
Docs:
Generate a localized EAN-8 barcode.
This method uses |localized_ean| under the hood with the ``length``
argument explicitly set to ``8``.
Example:
'02503691'
upc_a
Type: str
Docs:
Generate a 12-digit UPC-A barcode.
The value of ``upc_ae_mode`` controls how barcodes will be generated. If
``False`` (default), barcodes are not guaranteed to have a UPC-E
equivalent. In this mode, the method uses |EnUsBarcodeProvider.ean13|
under the hood, and the values of ``base`` and ``number_system_digit``
will be ignored.
If ``upc_ae_mode`` is ``True``, the resulting barcodes are guaranteed to
have a UPC-E equivalent, and the values of ``base`` and
``number_system_digit`` will be used to control what is generated.
Under this mode, ``base`` is expected to have a 6-digit string value. If
any other value is supplied, a random 6-digit string will be used
instead. As for ``number_system_digit``, the expected value is a ``0``
or a ``1``. If any other value is provided, this method will randomly
choose from the two.
.. important::
When ``upc_ae_mode`` is enabled, you might encounter instances where
different values of ``base`` (e.g. ``'120003'`` and ``'120004'``)
produce the same UPC-A barcode. This is normal, and the reason lies
within the whole conversion process. To learn more about this and
what ``base`` and ``number_system_digit`` actually represent, please
refer to |EnUsBarcodeProvider.upc_e|.
:sample:
:sample: upc_ae_mode=True, number_system_digit=0
:sample: upc_ae_mode=True, number_system_digit=1
:sample: upc_ae_mode=True, base='123456', number_system_digit=0
:sample: upc_ae_mode=True, base='120003', number_system_digit=0
:sample: upc_ae_mode=True, base='120004', number_system_digit=0
Example:
'999889706809'
upc_e
Type: str
Docs:
Generate an 8-digit UPC-E barcode.
UPC-E barcodes can be expressed in 6, 7, or 8-digit formats, but this
method uses the 8 digit format, since it is trivial to convert to the
other two formats. The first digit (starting from the left) is
controlled by ``number_system_digit``, and it can only be a ``0`` or a
``1``. The last digit is the check digit that is inherited from the
UPC-E barcode's UPC-A equivalent. The middle six digits are collectively
referred to as the ``base`` (for a lack of a better term).
On that note, this method uses ``base`` and ``number_system_digit`` to
first generate a UPC-A barcode for the check digit, and what happens
next depends on the value of ``safe_mode``. The argument ``safe_mode``
exists, because there are some UPC-E values that share the same UPC-A
equivalent. For example, any UPC-E barcode of the form ``abc0000d``,
``abc0003d``, and ``abc0004d`` share the same UPC-A value
``abc00000000d``, but that UPC-A value will only convert to ``abc0000d``
because of (a) how UPC-E is just a zero-suppressed version of UPC-A and
(b) the rules around the conversion.
If ``safe_mode`` is ``True`` (default), this method performs another set
of conversions to guarantee that the UPC-E barcodes generated can be
converted to UPC-A, and that UPC-A barcode can be converted back to the
original UPC-E barcode. Using the example above, even if the bases
``120003`` or ``120004`` are used, the resulting UPC-E barcode will
always use the base ``120000``.
If ``safe_mode`` is ``False``, then the ``number_system_digit``,
``base``, and the computed check digit will just be concatenated
together to produce the UPC-E barcode, and attempting to convert the
barcode to UPC-A and back again to UPC-E will exhibit the behavior
described above.
:sample:
:sample: base='123456'
:sample: base='123456', number_system_digit=0
:sample: base='123456', number_system_digit=1
:sample: base='120000', number_system_digit=0
:sample: base='120003', number_system_digit=0
:sample: base='120004', number_system_digit=0
:sample: base='120000', number_system_digit=0, safe_mode=False
:sample: base='120003', number_system_digit=0, safe_mode=False
:sample: base='120004', number_system_digit=0, safe_mode=False
Example:
'06541866'
bank.en_GB
aba
Type: str
Docs:
Generate an ABA routing transit number.
Example:
'051405544'
bank_country
Type: str
Docs:
Generate the bank provider's ISO 3166-1 alpha-2 country code.
Example:
'GB'
bban
Type: str
Docs:
Generate a Basic Bank Account Number (BBAN).
Example:
'PRAM73251040790949'
iban
Type: str
Docs:
Generate an International Bank Account Number (IBAN).
Example:
'GB37QJBH48247992115402'
swift
Type: str
Docs:
Generate a SWIFT code.
SWIFT codes, reading from left to right, are composed of a 4 alphabet
character bank code, a 2 alphabet character country code, a 2
alphanumeric location code, and an optional 3 alphanumeric branch code.
This means SWIFT codes can only have 8 or 11 characters, so the value of
``length`` can only be ``None`` or the integers ``8`` or ``11``. If the
value is ``None``, then a value of ``8`` or ``11`` will randomly be
assigned.
Because all 8-digit SWIFT codes already refer to the primary branch or
office, the ``primary`` argument only has an effect if the value of
``length`` is ``11``. If ``primary`` is ``True`` and ``length`` is
``11``, the 11-digit SWIFT codes generated will always end in ``'XXX'``
to denote that they belong to primary branches/offices.
For extra authenticity, localized providers may opt to include SWIFT
bank codes, location codes, and branch codes used in their respective
locales. If ``use_dataset`` is ``True``, this method will generate SWIFT
codes based on those locale-specific codes if included. If those codes
were not included, then it will behave as if ``use_dataset`` were
``False``, and in that mode, all those codes will just be randomly
generated as per the specification.
:sample:
:sample: length=8
:sample: length=8, use_dataset=True
:sample: length=11
:sample: length=11, primary=True
:sample: length=11, use_dataset=True
:sample: length=11, primary=True, use_dataset=True
Example:
'THYOGBLR'
swift11
Type: str
Docs:
Generate an 11-digit SWIFT code.
This method uses |swift| under the hood with the ``length`` argument set
to ``11``. If ``primary`` is set to ``True``, the SWIFT code will always
end with ``'XXX'``. All 11-digit SWIFT codes use this convention to
refer to the primary branch/office.
:sample:
:sample: use_dataset=True
Example:
'LCCHGBILVWS'
swift8
Type: str
Docs:
Generate an 8-digit SWIFT code.
This method uses |swift| under the hood with the ``length`` argument set
to ``8`` and with the ``primary`` argument omitted. All 8-digit SWIFT
codes already refer to the primary branch/office.
:sample:
:sample: use_dataset=True
Example:
'MPDQGBPS'
automotive.en_US
license_plate
Type: str
Docs:
Generate a license plate.
Example:
'549-IWD'
vin
Type: str
Docs:
Generate vin number.
Example:
'HD8TWHAU893V07146'
address.en_US
address
Type: str
Docs:
:example: '791 Crist Parks, Sashabury, IL 86039-9874'
Example:
'8917 Sanchez Forge\nKyleland, MS 69178'
administrative_unit
Type: str
Docs:
None
Example:
'West Virginia'
building_number
Type: str
Docs:
:example: '791'
Example:
'460'
city
Type: str
Docs:
:example: 'Sashabury'
Example:
'Patrickton'
city_prefix
Type: str
Docs:
None
Example:
'South'
city_suffix
Type: str
Docs:
:example: 'town'
Example:
'shire'
country
Type: str
Docs:
:sample:
Example:
'Cambodia'
country_code
Type: str
Docs:
:sample:
:sample: representation='alpha-2'
:sample: representation='alpha-3'
Example:
'VA'
current_country
Type: str
Docs:
:sample:
Example:
'United States'
current_country_code
Type: str
Docs:
:sample:
Example:
'US'
military_apo
Type: str
Docs:
:example: 'PSC 5394 Box 3492
Example:
'PSC 7954, Box 8194'
military_dpo
Type: str
Docs:
:example: 'Unit 3333 Box 9342'
Example:
'Unit 8257 Box 7822'
military_ship
Type: str
Docs:
:example: 'USS'
Example:
'USCGC'
military_state
Type: str
Docs:
:example: 'APO'
Example:
'AE'
postalcode
Type: str
Docs:
None
Example:
'99899'
postalcode_in_state
Type: str
Docs:
None
Example:
'85896'
postalcode_plus4
Type: str
Docs:
None
Example:
'67001-2560'
postcode
Type: str
Docs:
None
Example:
'79763'
postcode_in_state
Type: str
Docs:
:returns: A random postcode within the provided state abbreviation
:param state_abbr: A state abbreviation
Example:
'99720'
secondary_address
Type: str
Docs:
None
Example:
'Apt. 379'
state
Type: str
Docs:
None
Example:
'Montana'
state_abbr
Type: str
Docs:
:returns: A random two-letter USPS postal code
By default, the resulting code may abbreviate any of the fifty states,
five US territories, or three freely-associating sovereign states.
:param include_territories: If True, territories will be included.
If False, US territories will be excluded.
:param include_freely_associated_states: If True, freely-associated states will be included.
If False, sovereign states in free association with the US will be excluded.
Example:
'GA'
street_address
Type: str
Docs:
:example: '791 Crist Parks'
Example:
'574 Brianna Drives'
street_name
Type: str
Docs:
:example: 'Crist Parks'
Example:
'Dana Locks'
street_suffix
Type: str
Docs:
:example: 'Avenue'
Example:
'Greens'
zipcode
Type: str
Docs:
None
Example:
'20739'
zipcode_in_state
Type: str
Docs:
None
Example:
'58609'
zipcode_plus4
Type: str
Docs:
None
Example:
'28758-0657'