API Reference

This part of the documentation covers all the interfaces of Elizabeth.

Generic

class elizabeth.Generic(locale)

A lazy initialization of locale for all classes that have locales.

__init__(locale)
Parameters:locale – Current locale.
add_provider(cls)

Add a custom provider to Generic() object.

Parameters:cls – Custom provider.
Returns:None
add_providers(*providers)

Add a lot of custom providers to Generic() object.

Parameters:providers – Custom providers.
Returns:None

Providers

Address

class elizabeth.Address(locale='en')

Class for generate fake address data.

__init__(locale='en')
Parameters:locale – Current locale.
address()

Get a random full address (include Street number, suffix and name).

Returns:Full address.
Example:5 Central Sideline.
city()

Get a random city for current locale.

Returns:City name.
Example:Saint Petersburg.
continent(code=False)

Get a random continent name or continent code (code in international format)

Returns:Continent name.
Example:Africa (en)
coordinates()

Generate random geo coordinates.

Returns:Dict with coordinates.
Return type:dict
Example:{‘latitude’: 8.003968712834975, ‘longitude’: 36.02811153405548}
country()

Get a random country.

Returns:The Country.
Example:Russia.
static country_iso(fmt='iso2')

Get a random ISO code of country.

Parameters:fmt – Format of code (iso2, iso3, numeric).
Returns:ISO Code.
Example:DE
static latitude()

Generate a random value of latitude (-90 to +90).

Returns:Value of longitude.
Example:-66.4214188124611
static longitude()

Generate a random value of longitude (-180 to +180).

Returns:Value of longitude.
Example:112.18440260511943
postal_code()

Generate a postal code for current locale.

Returns:Postal code.
Example:389213
state(abbr=False)

Get a random states or subject of country.

Parameters:abbr – If True then return ISO (ISO 3166-2)

code of state/region/province/subject. :return: State of current country. :Example:

Alabama (for locale en).
street_name()

Get a random street name.

Returns:Street name.
Example:Candlewood.
static street_number(maximum=1400)

Generate a random street number.

Returns:

Street number.

Example:
street_suffix()

Get a random street suffix.

Returns:Street suffix.
Example:Alley.

Business

class elizabeth.Business(locale='en')

Class for generating data for business.

__init__(locale='en')
Parameters:locale – Current locale.
company()

Get a random company name.

Returns:Company name.
Example:Gamma Systems.
company_type(abbr=False)

Get a random type of business entity.

Parameters:abbr – If True then return abbreviated company type.
Returns:Types of business entity.
Example:Incorporated.
copyright()

Generate a random copyright.

Returns:Dummy copyright of company.
Example:© 1990-2016 Komercia, Inc.
static currency_iso()

Get a currency code. ISO 4217 format.

Returns:Currency code.
Example:RUR.
price(minimum=10.0, maximum=1000.0)

Generate a random price.

Parameters:
  • minimum
  • maximum
Returns:

Price.

Example:

599.99 $.

ClothingSizes

class elizabeth.ClothingSizes

Class for generate clothing sizes data

static custom(minimum=40, maximum=62)

Generate clothing size using custom format.

Parameters:
  • minimum – Min value.
  • maximum – Max value
Returns:

Clothing size.

Example:

44

static european()

Generate a random clothing size in European format.

Returns:Clothing size.
Example:42
static international()

Get a random size in international format.

Returns:Clothing size.
Example:XXL.

Code

class elizabeth.Code(locale)

Class that provides methods for generating codes (isbn, asin & etc.)

__init__(locale)
Parameters:locale – Current locale.
static custom_code(mask='@###', char='@', digit='#')

Generate custom code using ascii uppercase and random integers.

Parameters:
  • mask – Mask of code.
  • char – Placeholder for characters.
  • digit – Placeholder for digits.
Returns:

Custom code.

Example:

5673-AGFR-SFSFF-1423-4/AD.

ean(fmt='ean-13')

Generate EAN (European Article Number) code. Default is EAN-13, but you also can use EAN-8.

Parameters:

fmt – Format of EAN.

Returns:

EAN.

Example:
imei()

Generate a random IMEI (International Mobile Station Equipment Identity).

Returns:IMEI.
Example:

353918052107063

isbn(fmt='isbn-10')

Generate ISBN for current locale. Default is ISBN 10, but you also can use ISBN-13.

Parameters:fmt – ISBN format.
Returns:ISBN.
Example:132-1-15411-375-8.
issn(mask=None)

Generate a random International Standard Serial Number (ISSN).

Parameters:mask – Mask ISSN.
Returns:ISSN.
static locale_code()

Get a random locale code (MS-LCID). See Windows Language Code Identifier Reference for more information.

Returns:Locale code.
Return type:str
Example:de-ch
pin(mask='####')

Generate a random PIN code.

Returns:

PIN code.

Example:

Datetime

class elizabeth.Datetime(locale='en')

Class for generate the fake data that you can use for working with date and time.

__init__(locale='en')
Parameters:locale – Current locale.
static century()

Get a random value from list of centuries (roman format).

Returns:Century.
Example:XXI
date(start=2000, end=2035, fmt=None)

Generate a string representing of random date formatted for the locale or as specified.

Parameters:
  • start – Minimum value of year.
  • end – Maximum value of year.
  • fmt – Format string for date.
Returns:

Formatted date.

Example:

08/16/88 (en)

static day_of_month()

Generate a random day of month, from 1 to 31.

Returns:Random value from 1 to 31.
Example:23
day_of_week(abbr=False)

Get a random day of week.

Parameters:abbr – Abbreviated name of the day.
Returns:Name of day of the week.
Example:Wednesday (Wed. when abbr=True).
month(abbr=False)

Get a random month.

Parameters:abbr – if True then will be returned abbreviated month name.
Returns:Month name.
Example:January (Jan. when abbr=True).
periodicity()

Get a random periodicity string.

Returns:Periodicity.
Example:Never.
time(fmt=None)

Generate a random time formatted for the locale or as specified.

Returns:Time.
Example:21:30:00 (en)
static year(minimum=1990, maximum=2050)

Generate a random year.

Parameters:
  • minimum – Minimum value.
  • maximum – Maximum value
Returns:

Year.

Example:

Development

class elizabeth.Development

Class for getting fake data for Developers.

static backend()

Get a random backend stack.

Returns:Stack.
Example:Elixir/Phoenix
static container()

Get a random containerization system.

Returns:Containerization system.
Example:Docker.
static database(nosql=False)

Get a random database name.

Parameters:nosql – only NoSQL databases.
Returns:Database name.
Example:PostgreSQL.
static frontend()

Get a random front-end stack.

Returns:Stack.
Example:JS/React.
static os()

Get a random operating system or distributive name.

Returns:The name of OS.
Example:Gentoo
static programming_language()

Get a random programming language from the list.

Returns:Programming language.
Example:Erlang.
static software_license()

Get a random software license from list.

Returns:License name.
Return type:str
Example:The BSD 3-Clause License.
static stackoverflow_question()

Generate a random question id for StackOverFlow and return url to a question.

Returns:URL to a question.
Example:http://stackoverflow.com/questions/1726403
static version()

Generate a random version information.

Returns:The version of software.
Example:0.11.3.
static version_control_system()

Get a random version control system.

Returns:Version control system
Example:Git

File

class elizabeth.File

Class for generate fake data for files.

static extension(file_type='text')

Get a random file extension from list.

Parameters:file_type – File type (source, text, data, audio, video, image,

executable, compressed). :return: Extension of a file. :Example:

.py (file_type=’source’).
static mime_type(type_t='application')

Get a random mime type from list.

Returns:Mime type.
Parameters:type_t – Type of media: (application,

image, video, audio, text, message). :rtype: str

Food

class elizabeth.Food(locale='en')

Class for Food, i.e fruits, vegetables, berries and other.

__init__(locale='en')
Parameters:locale – Current locale.
dish()

Get a random dish for current locale.

Returns:Dish name.
Example:Ratatouille.
drink()

Get a random drink.

Returns:Alcoholic drink.
Example:Vodka.
fruit()

Get a random name of fruit or berry .

Returns:Fruit.
Example:Banana.
spices()

Get a random spices or herbs.

Returns:Spices or herbs.
Example:Anise.
vegetable()

Get a random vegetable.

Returns:Vegetable.
Example:Tomato.

Hardware

class elizabeth.core.Hardware

Class for generate data about hardware.

static cpu()

Get a random CPU name.

Returns:CPU name.
Example:Intel® Core i7.
static cpu_codename()

Get a random CPU code name.

Returns:CPU code name.
Example:Cannonlake.
static cpu_frequency()

Get a random frequency of CPU.

Returns:Frequency of CPU.
Example:4.0 GHz.
static generation(abbr=False)

Get a random generation.

Returns:Generation of something.
Example:6th Generation.
static graphics()

Get a random graphics.

Returns:Graphics.
Example:Intel® Iris™ Pro Graphics 6200.
static manufacturer()

Get a random manufacturer.

Returns:Manufacturer.
Example:Dell.
static phone_model()

Get a random phone model.

Returns:Phone model.
Example:Nokia Lumia 920.
static ram_size()

Get a random size of RAM.

Returns:RAM size.
Example:16GB.
static ram_type()

Get a random RAM type.

Returns:Type of RAM.
Example:DDR3.
static resolution()

Get a random screen resolution.

Returns:Resolution of screen.
Example:1280x720.
static screen_size()

Get a random size of screen in inch.

Returns:Screen size.
Example:13″.
static ssd_or_hdd()

Get a random value from list.

Returns:HDD or SSD.
Example:512GB SSD.

Internet

class elizabeth.core.Internet

Class for generate the internet data.

static content_type(mime_type='application')

Get a random HTTP content type.

Returns:Content type.
Example:Content-Type: application/json
static emoji()

Get a random emoji shortcut code.

Returns:

Emoji code.

Example:
kissing:
static hashtags(quantity=4, category='general')

Create a list of hashtags (for Instagram, Twitter etc.)

Parameters:
  • quantity (int) – The quantity of hashtags.
  • category – Available categories: general, girls, love,

boys, friends, family, nature, travel, cars, sport, tumblr. :return: The list of hashtags. :rtype: list

Example:[‘#love’, ‘#sky’, ‘#nice’].
static home_page(gender='female')

Generate a random home page.

Parameters:gender – Gender of author of site.
Returns:Random home page.
Example:http://www.font6.info
static http_method()

Get a random HTTP method.

Returns:HTTP method.
Example:POST
static http_status_code(code_only=True)

Get a random HTTP status.

Parameters:code_only – Return only http status code.
Returns:HTTP status.
Example:200 OK
static image_placeholder(width='400', height='300')

Generate a link to the image placeholder.

Parameters:
  • width – Width of image.
  • height – Height of image.
Returns:

URL to image placeholder.

static ip_v4()

Generate a random IPv4 address.

Returns:Random IPv4 address.
Example:19.121.223.58
static ip_v6()

Generate a random IPv6 address.

Returns:Random IPv6 address.
Example:2001:c244:cf9d:1fb1:c56d:f52c:8a04:94f3
static mac_address()

Generate a random MAC address.

Returns:Random MAC address.
Example:00:16:3e:25:e7:b1
static network_protocol(layer='application')

Get a random network protocol form OSI model.

Parameters:layer – Layer of protocol: application, data_link,

network, physical, presentation, session and transport. :return: Protocol name. :Example:

AMQP
static stock_image(category=None, width=1900, height=1080)

Get a random beautiful stock image that hosted on Unsplash.com

Parameters:category – Category of image. Available: ‘buildings’, ‘food’,

‘nature’, ‘people’, ‘technology’, ‘objects’. :param width: Width of the image. :param height: Height of the image. :return: An image (Link to image).

static subreddit(nsfw=False, full_url=False)

Get a random subreddit from the list.

Parameters:
  • nsfw – NSFW subreddit.
  • full_url – Full URL address.
Returns:

Subreddit or URL to subreddit.

Example:

https://www.reddit.com/r/flask/

static user_agent()

Get a random user agent.

Returns:User agent.
Example:Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:15.0) Gecko/20100101 Firefox/15.0.1

Network

Numbers

class elizabeth.Numbers

Class for generating numbers

static between(minimum=1, maximum=1000)

Generate a random number between minimum and maximum.

Parameters:
  • minimum – Minimum of range.
  • maximum – Maximum of range
Returns:

Number

static digit(to_bin=False)

Get a random digit.

Parameters:

to_bin – If True then convert to binary.

Returns:

Digit.

Example:
static floats(n=2, type_code='f', to_list=False)

Generate an array of random float number of 10**n.

Type Code C Type Storage size Value range
‘f’ floating point 4 byte 1.2E-38 to 3.4E+38
‘d’ floating point 8 byte 2.3E-308 to 1.7E+308
Parameters:
  • n – Raise 10 to the ‘n’ power.
  • type_code – A code of type.
  • to_list – Convert array to list.

Note

When you work with large numbers, it is better not to use this option, because type ‘array’ much faster than ‘list’.

Returns:An array of floating-point numbers.
static primes(start=1, end=999, to_list=False)

Generate an array of prime numbers of 10 ** n.

Type Code | C Type Storage size Value range
‘L’ unsigned integer 4 byte 0 to 4,294,967,295
Parameters:
  • start – First value of range.
  • end – Last value of range.
  • to_list – Convert array to list.
Returns:

An array of floating-point numbers.

static rating(maximum=5.0)

Generate random rating for something.

Parameters:maximum – Minimum value (default is 5.0).
Returns:Rating.
Return type:float
Example:4.7

Path

class elizabeth.Path

Class that provides methods and property for generate paths.

dev_dir(user_gender='female')

Generate a random path to development directory.

Parameters:user_gender – Path to dev directory.
Returns:Path.
Example:/home/sherrell/Development/Python/mercenary
home

Generate a home path.

Returns:Home path.
Example:/home/
project_dir(user_gender='female')

Generate a random path to project directory.

Parameters:user_gender – Gender of user.
Returns:Path to project.
Example:/home/sherika/Development/Falcon/mercenary
root

Generate a root dir path.

Returns:Root dir.
Example:/
user(gender='female')

Generate a random user.

Parameters:gender – Gender of user.
Returns:Path to user.
Example:/home/oretha
users_folder(user_gender='female')

Generate a random path to user’s folders.

Returns:Path.
Example:/home/taneka/Pictures

Personal

class elizabeth.Personal(locale='en')

Class for generate personal data, i.e names, surnames, age and another.

__init__(locale='en')
Parameters:locale – Current locale.
academic_degree()

Get a random academic degree.

Returns:Degree.
Example:Bachelor.
age(minimum=16, maximum=66)

Get a random integer value.

Parameters:
  • maximum – max age
  • minimum – min age
Returns:

Random integer (from minimum=16 to maximum=66)

Example:
avatar(size=256)

Generate a random avatar (link to avatar) using API of Adorable.io.

Returns:Link to avatar.
Example:https://api.adorable.io/avatars/64/875ed3de1604812b3c2b592c05863f47.png
static bitcoin()

Generate a random bitcoin address. Currently supported only two address formats that are most popular: ‘P2PKH’ and ‘P2SH’

Returns:Bitcoin address.
Example:3EktnHQD7RiAE6uzMj2ZifT9YgRrkSgzQX
static blood_type()

Get a random blood type.

Returns:Blood type (blood group).
Example:A+
child_count(max_childs=5)

Get a count of child’s.

Parameters:max_childs – Maximum count of child’s.
Returns:Ints. Depend on previous generated age.
static cid()

Generate a random CID code.

Returns:CID code.
Example:7452
static credit_card_expiration_date(minimum=16, maximum=25)

Generate a random expiration date for credit card.

Parameters:
  • minimum – Date of issue.
  • maximum – Maximum of expiration_date.
Returns:

Expiration date of credit card.

Return type:

str

Example:

03/19.

static credit_card_number(card_type='visa')

Generate a random credit card number.

Parameters:card_type – Issuing Network. Default is Visa.
Returns:Credit card number.
Example:4455 5299 1152 2450
static cvv()

Generate a random card verification value (CVV).

Returns:CVV code.
Return type:int
Example:324
email(gender='female', domains=None)

Generate a random email.

Parameters:
  • gender (str) – Gender of the user.
  • domains (list, tuple) – Custom domain for email.
Returns:

Email address.

Example:

foretime10@live.com

favorite_movie()

Get a random movie for current locale.

Returns:The name of the movie.
Example:Interstellar.
static favorite_music_genre()

Get a random music genre.

Returns:A music genre.
Example:Ambient.
full_name(gender='female', reverse=False)

Generate a random full name.

Parameters:
  • reverse – if true: surname/name else name/surname
  • gender – if gender=’male’ then will be returned male name else female name.
Returns:

Full name.

Example:

Johann Wolfgang.

gender(iso5218=False, symbol=False)

Get a random title of gender, code for the representation of human sexes is an international standard that defines a representation of human sexes through a language-neutral single-digit code or symbol of gender.

Parameters:iso5218 – Codes for the representation of human sexes

is an international standard. :param symbol: Symbol of gender. :return: Title of gender. :rtype: str :Example:

Male
static height(minimum=1.5, maximum=2.0)

Generate a random height in M (Meter).

Parameters:
  • minimum – Minimum value.
  • maximum – Maximum value.
Returns:

Height.

Example:

1.85.

static identifier(mask='##-##/##')

Generate a random identifier by mask. With this method you can generate any identifiers that you need. Simply select the mask that you need.

Parameters:mask – The mask. Here ‘@’ is a placeholder for characters

and ‘#’ is placeholder for digits. :return: An identifier. :Example:

07-97/04
language()

Get a random language.

Returns:Random language.
Example:Irish.
static level_of_english()

Get a random level of English.

Returns:Level of english.
Example:Intermediate.
name(gender='female')

Get a random name.

Parameters:gender – if ‘male’ then will getting male name else female name.
Returns:Name.
Example:John.
nationality(gender='female')

Get a random nationality.

Parameters:gender – female or male
Returns:Nationality.
Example:Russian.
occupation()

Get a random job.

Returns:The name of job.
Example:Programmer.
static password(length=8, algorithm=None)

Generate a password or hash of password.

Parameters:
  • length – Length of password.
  • algorithm – Hashing algorithm.
Returns:

Password or hash of password.

Example:

k6dv2odff9#4h (without hashing).

paypal()

Generate a random PayPal account.

Returns:Email of PapPal user.
Example:wolf235@gmail.com
political_views()

Get a random political views.

Returns:Political views.
Example:Liberal.
sexual_orientation(symbol=False)

Get a random (LOL) sexual orientation.

Parameters:symbol – Unicode symbol.
Returns:Sexual orientation.
Example:Heterosexuality.
social_media_profile(gender='female')

Generate profile for random social network.

Parameters:gender – Gender of user.
Returns:Profile in some network.
Example:http://facebook.com/some_user
surname(gender='female')

Get a random surname.

Parameters:gender – The gender of person.
Returns:Surname.
Example:Smith.
telephone(mask=None, placeholder='#')

Generate a random phone number.

Parameters:
  • mask – Mask for formatting number.
  • placeholder – A placeholder for a mask (default is #).
Returns:

Phone number.

Example:

+7-(963)-409-11-22.

title(gender='female', title_type='typical')

Get a random title (prefix/suffix) for name.

Parameters:
  • gender – The gender.
  • title_type – The type of title (‘typical’ and ‘academic’).
Returns:

The title.

Example:

PhD.

university()

Get a random university.

Returns:University name.
Example:MIT.
static username(gender='female')

Get a random username with digits. Username generated from names (en) for all locales.

Returns:Username.
Return type:str
Example:abby1189.
views_on()

Get a random views on.

Returns:Views on.
Example:Negative.
static weight(minimum=38, maximum=90)

Generate a random weight in Kg.

Parameters:
  • minimum – min value
  • maximum – max value
Returns:

Weight.

Example:
work_experience(working_start_age=22)

Get a work experience.

Parameters:working_start_age – Age then person start to work.
Returns:Int. Depend on previous generated age.
worldview()

Get a random worldview.

Returns:Worldview.
Example:Pantheism.

Science

class elizabeth.Science(locale='en')

Class for getting scientific data

__init__(locale='en')
Parameters:locale – Current language.
chemical_element(name_only=True)

Generate a random chemical element.

Parameters:name_only – If False then will be returned dict.
Returns:Name of chemical element or dict.
Example:{‘Symbol’: ‘S’, ‘Name’: ‘Sulfur’, ‘Atomic number’: ‘16’}
static math_formula()

Get a random mathematical formula.

Returns:Math formula.
Example:A = (ab)/2.
scientific_article()

Generate a random link to scientific article on Wikipedia.

Returns:Link to article on Wikipedia.
Example:https://en.wikipedia.org/wiki/Black_hole

Structured

class elizabeth.Structured(locale='en')

Provider for structured text data such as CSS, Delimited, HTML, etc.

__init__(locale='en')
Parameters:locale – Current locale.
css()

Generates a random snippet of CSS.

Returns:

CSS.

Return type:

str

Example:
‘strong {

pointer: crosshair; padding-right: 46pt; margin-left: 38em; padding-right: 65em

}’

css_property()

Generates a random snippet of CSS that assigns value to a property.

Returns:CSS property.
Return type:str
Examples:‘background-color: #f4d3a1’
html()

Generate a random HTML tag with text inside and some attrs set.

Returns:

HTML.

Return type:

str

Examples:
‘<span class=”select” id=”careers”>

Ports are created with the built-in function open_port.

</span>’

html_attribute_value(tag, attribute)

Random value for specified HTML tag attribute.

Parameters:
  • tag (str) – An HTML tag.
  • attribute (str) – An attribute of the specified tag.
Returns:

An attribute.

Return type:

str

json(provider_name, items=5)

Generate a random snippet of JSON

Parameters:
  • provider_name (str) – Name of provider to generate JSON data for.
  • items (int) – Number of top-level items to include.
Returns:

JSON.

Return type:

str

Text

class elizabeth.Text(locale='en')

Class for generate text data, i.e text, lorem ipsum and another.

__init__(locale='en')
Parameters:locale – Current locale.
alphabet(letter_case=None)

Get an alphabet for current locale.

Parameters:letter_case – Letter case.
Returns:Alphabet.
Return type:list
answer()

Get a random answer in current language.

Returns:An answer.
Return type:str
Example:No
color()

Get a random name of color.

Returns:Color name.
Example:Red.
static hex_color()

Generate a hex color.

Returns:Hex color code.
Example:#D8346B
level()

Generate a random level of danger or something else.

Returns:Level.
Example:critical.
quote()

Get a random quote.

Returns:Quote from movie.
Example:“Bond... James Bond.”
sentence()

Get a random sentence from text.

Returns:Sentence.
Example:Any element of a tuple can be accessed in constant time.
swear_word()

Get a random swear word.

Returns:Swear word.
Example:Damn.
text(quantity=5)

Generate the text.

Parameters:quantity – Quantity of sentences.
Returns:Text.
Example:Haskell is a standardized, general-purpose purely functional programming language, with non-strict semantics and strong static typing.
title()

Get a random title.

Returns:The title.
Example:Erlang - is a general-purpose, concurrent, functional programming language.
word()

Get a random word.

Returns:Single word.
Example:Science.
words(quantity=5)

Get the random words.

Parameters:quantity – Quantity of words. Default is 5.
Returns:Word list.
Example:science, network, god, octopus, love.

Transport

class elizabeth.Transport

Class that provides dummy data about transport.

airplane(model_mask='###')

Generate a dummy airplane model.

Parameters:model_mask – Mask of truck model. Here ‘@’ is a placeholder of characters and ‘#’ is a placeholder of digits.
Returns:
Example:Boeing 727.
static car()

Get a random vehicle.

Returns:A vehicle.
Example:Tesla Model S.
truck(model_mask='#### @@')

Generate a truck model.

Parameters:model_mask – Mask of truck model. Here ‘@’ is a placeholder of characters and ‘#’ is a placeholder of digits.
Returns:Dummy truck model.
Example:Caledon-966O.

Exceptions

exception elizabeth.exceptions.JSONKeyError

An exception that raised when JSON key doesn’t exist

exception elizabeth.exceptions.NotImplementedYet

An exception that raised when NotImplementedError

exception elizabeth.exceptions.UnsupportedLocale

An exception that raised when a locale doesn’t supported.

exception elizabeth.exceptions.WrongArgument

An exception that raised when argument is wrong