Skip to main content

internet Domain

The internet domain maps domain keywords to underlying faker implementations.

Faker Documentation

Methods

internet.color

Generates a random css hex color code in aesthetically pleasing color palette.

No parameters.

Examples:

internet.color()

Example return values:

  • #290551

internet.displayName

Generates a display name using the given person's name as base.

No parameters.

Examples:

internet.displayName()

Example return values:

  • Cordell0

internet.domainName

Generates a random domain name.

No parameters.

Examples:

internet.domainName()

Example return values:

  • beloved-peony.org

internet.domainSuffix

Returns a random domain suffix.

No parameters.

Examples:

internet.domainSuffix()

Example return values:

  • com

internet.domainWord

Generates a random domain word.

No parameters.

Examples:

internet.domainWord()

Example return values:

  • inexperienced-ravioli

internet.email

Generates data using faker internet email.

ArgTypeRequiredDescription
allowSpecialCharactersbooleannoWhether special characters such as .!#$%&'*+-/=?^_`{|}~ should be included in the email address.
firstNamestringnoThe optional first name to use.
lastNamestringnoThe optional last name to use.
providerstringnoThe mail provider domain to use. If not specified, a random free mail provider will be chosen.

Examples:

internet.email()
internet.email(allowSpecialCharacters=true, firstName="Alex", lastName="Taylor", provider="example.com")

Example return values:

  • Jana91@hotmail.com

internet.emoji

Generates a random emoji.

ArgTypeRequiredDescription
typesarraynoA list of the emoji types that should be used.

Examples:

internet.emoji()
internet.emoji(types=["food","nature"])

Example return values:

  • 🤨

internet.exampleEmail

Generates data using faker internet example email.

No parameters.

Examples:

internet.exampleEmail()

Example return values:

  • Jeremie37@example.net

internet.httpMethod

Returns a random http method.

No parameters.

Examples:

internet.httpMethod()

Example return values:

  • PATCH

internet.httpStatusCode

Generates a random HTTP status code.

No parameters.

Examples:

internet.httpStatusCode()

Example return values:

  • 303

internet.ip

Generates a random IPv4 or IPv6 address.

No parameters.

Examples:

internet.ip()

Example return values:

  • 56.23.30.52

internet.ipv4

Generates a random IPv4 address.

ArgTypeRequiredDescription
cidrBlockstringnoThe optional CIDR block to use. Must be in the format x.x.x.x/y.
networkstringnoThe optional network to use. This is intended as an alias for well-known cidrBlocks.

Examples:

internet.ipv4()
internet.ipv4(cidrBlock="192.168.0.0/24", network="private-a")

Example return values:

  • 192.168.0.42

internet.ipv6

Generates a random IPv6 address.

No parameters.

Examples:

internet.ipv6()

Example return values:

  • 2001:0db8:85a3:0000:0000:8a2e:0370:7334

internet.jwt

Generates a random JWT (JSON Web Token).

ArgTypeRequiredDescription
headerobjectnoThe header to use for the token. If present, it will replace any default values.
payloadobjectnoThe payload to use for the token. If present, it will replace any default values.
refDatenumbernoReference date as a Unix timestamp in milliseconds since epoch used as the generation anchor.

Examples:

internet.jwt()
internet.jwt(header={"alg":"HS256","typ":"JWT"}, payload={"iss":"Acme"}, refDate=1)

Example return values:

  • eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJBY21lIn0.c2lnbmF0dXJl

internet.jwtAlgorithm

Generates a random JWT (JSON Web Token) Algorithm.

No parameters.

Examples:

internet.jwtAlgorithm()

Example return values:

  • PS384

internet.mac

Generates a random mac address.

ArgTypeRequiredDescription
separatorstringnoThe optional separator to use. Can be either ':', '-' or ''.

Examples:

internet.mac()
internet.mac(separator="-")

Example return values:

  • ae:a9:d7:ba:d2:bd

internet.password

Generates a random password-like string. Do not use this method for generating actual passwords for users.

ArgTypeRequiredDescription
lengthintegernoThe length of the password to generate.
memorablebooleannoWhether the generated password should be memorable.
patternregexpnoThe pattern that all chars should match. This option will be ignored, if memorable is true.
prefixstringnoThe prefix to use.

Examples:

internet.password(length=10, memorable=false, pattern="[A-Za-z0-9]", prefix="#")

Example return values:

  • og1ejoksrfwVbIF

internet.port

Generates a random port number.

No parameters.

Examples:

internet.port()

Example return values:

  • 24545

internet.protocol

Returns a random web protocol. Either http or https.

No parameters.

Examples:

internet.protocol()

Example return values:

  • http

internet.url

Generates a random http(s) url.

ArgTypeRequiredDescription
appendSlashbooleannoWhether to append a slash to the end of the url (path).
protocolstringnoThe protocol to use.

Examples:

internet.url()
internet.url(appendSlash=true, protocol="https")

Example return values:

  • https://brave-interior.biz/

internet.userAgent

Generates a random user agent string.

No parameters.

Examples:

internet.userAgent()

Example return values:

  • Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36

internet.username

Generates a username using the given person's name as base.

ArgTypeRequiredDescription
firstNamestringnoThe optional first name to use.
lastNamestringnoThe optional last name to use.

Examples:

internet.username()
internet.username(firstName="Alex", lastName="Taylor")

Example return values:

  • Deanna51

internet.userName

Generates a username using the given person's name as base.

No parameters.

Examples:

internet.userName()

Example return values:

  • Ana_Keebler