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:

  • "#2d5c7d"
  • "#604136"

internet.displayName

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

No parameters.

Examples:

internet.displayName()

Example return values:

  • "Donna_Willms14"
  • "Glenna70"

internet.domainName

Generates a random domain name.

No parameters.

Examples:

internet.domainName()

Example return values:

  • "carefree-kiss.net"
  • "monumental-independence.net"

internet.domainSuffix

Returns a random domain suffix.

No parameters.

Examples:

internet.domainSuffix()

Example return values:

  • "name"
  • "org"

internet.domainWord

Generates a random domain word.

No parameters.

Examples:

internet.domainWord()

Example return values:

  • "wry-outset"
  • "oily-paintwork"

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="gmail.com")

Example return values:

  • "Mayra65@gmail.com"
  • "Antone_Kub87@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:

  • "Spencer_Mante@example.com"
  • "Madison.Kub29@example.org"

internet.httpMethod

Returns a random http method.

No parameters.

Examples:

internet.httpMethod()

Example return values:

  • "PUT"
  • "DELETE"

internet.httpStatusCode

Generates a random HTTP status code.

No parameters.

Examples:

internet.httpStatusCode()

Example return values:

  • 505
  • 506

internet.ip

Generates a random IPv4 or IPv6 address.

No parameters.

Examples:

internet.ip()

Example return values:

  • "8eb3:eb0b:23f8:24af:dab0:32ff:b9e8:dfcb"
  • "224.35.99.161"

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:

  • "66.234.157.133"
  • "87.85.6.113"

internet.ipv6

Generates a random IPv6 address.

No parameters.

Examples:

internet.ipv6()

Example return values:

  • "efab:dbdb:dbc0:f3ed:4fc0:be73:ec76:08ac"
  • "8ccb:adb2:6eb1:eb7e:e6eb:bc3c:cd92:a021"

internet.jwt

Generates a random JWT (JSON Web Token).

ArgTypeRequiredDescription
headerarraynoThe header to use for the token. If present, it will replace any default values.
payloadarraynoThe 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=["sample"], payload=["sample"], refDate=1)

Example return values:

  • "eyJhbGciOiJFUzUxMiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE3NzkxMDUxODQsImV4cCI6MTc3OTExNjI0MCwibmJmIjoxNzU2MzczMzM2LCJpc3MiOiJIdWRzb24gSW5jIiwic3ViIjoiZDE3MTJkYzQtYjZlZi00MTA2LWIxYzUtNjlmNDJiNjljMjZjIiwiYXVkIjoiYzdlNjliODYtOWE4OS00MDZmLTgzYWItMDkzYzQ5MWNmZjQyIiwianRpIjoiMDI0NjNhNGUtMWNhNy00MGE2LWI1ZDktZGJjNTYyZWNjNDFiIn0.Gs8gUfYlSgDoJOaDI2NoNEfyMG0UUL88TkJApQkhFjIBD66avEjmn0BWxPHOq3Ub"
  • "eyJhbGciOiJIUzM4NCIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE3NzkwMjE1NDUsImV4cCI6MTc3OTA2MzMzMCwibmJmIjoxNzQ4Mjg4OTI2LCJpc3MiOiJWYW5kZXJ2b3J0LCBSb2JlbCBhbmQgQWx0ZW53ZXJ0aCIsInN1YiI6ImJkODUwNTg1LTI1YTAtNDAwOC04OWEzLTcwMDgyNGE2YjY5ZiIsImF1ZCI6IjhhYThhYzM0LWM1ZDgtNDdiZi1iMjVkLWE1MzI5NjVmMjdjNyIsImp0aSI6IjRlMjE3MDllLTg4ZGUtNDk1Ny04MzZmLTJiMTY3ODkzNDExZiJ9.o2Mmjn9y3Mfcj6N2LgWJGmv3fAbn2UyEbxIAeo1NyufQFwJA0UgzQ0e52Dv38mjo"

internet.jwtAlgorithm

Generates a random JWT (JSON Web Token) Algorithm.

No parameters.

Examples:

internet.jwtAlgorithm()

Example return values:

  • "HS384"

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:

  • "9d:65:b8:77:9e:e2"
  • "9e:d7:be:f2:62:0e"

internet.password

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

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

Examples:

internet.password()
internet.password(length=12, memorable=true, pattern="a", prefix="#")

Example return values:

  • "7FRCloUvbQ8D4zB"
  • "J89o3mPBaw0mEv9"

internet.port

Generates a random port number.

No parameters.

Examples:

internet.port()

Example return values:

  • 29644
  • 51998

internet.protocol

Returns a random web protocol. Either http or https.

No parameters.

Examples:

internet.protocol()

Example return values:

  • "https"

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://twin-newsletter.info"
  • "https://productive-conservation.org/"

internet.userAgent

Generates a random user agent string.

No parameters.

Examples:

internet.userAgent()

Example return values:

  • "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/556.49.37 (KHTML, like Gecko) Version/16.1 Safari/584.80.32"
  • "FakerBot/8.17.16"

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:

  • "Myles_King"
  • "Allie_Witting"

internet.userName

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

No parameters.

Examples:

internet.userName()

Example return values:

  • "Alba90"
  • "Keith3"