Skip to main content

internet Domain

The internet domain mostly maps domain keywords to faker-backed generators, but internet.httpMethod is implemented directly by AnywayData.

Faker Documentation

Methods

internet.displayName

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

ArgTypeRequiredDescription
firstNamestringnoOptional first name to use as the basis for the display name.
lastNamestringnoOptional last name to use as the basis for the display name.

Examples:

Shows the default internet.displayName call.

internet.displayName()

Returns: Aaliyah.Bosco

Shows internet.displayName using firstName and lastName options.

internet.displayName(firstName="Ada", lastName="Lovelace")

Returns: Ada72

Shows internet.displayName using an explicit first name.

internet.displayName(firstName="Ada")

Returns: Ada14

Shows internet.displayName using an explicit last name.

internet.displayName(lastName="Lovelace")

Returns: Aaliyah14

internet.domainName

Generates a random domain name.

No parameters.

Examples:

Shows the default internet.domainName call.

internet.domainName

Returns: inferior-punctuation.biz

internet.domainSuffix

Returns a random domain suffix.

No parameters.

Examples:

Shows the default internet.domainSuffix call.

internet.domainSuffix

Returns: info

internet.domainWord

Generates a random domain word.

No parameters.

Examples:

Shows the default internet.domainWord call.

internet.domainWord

Returns: inferior-punctuation

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:

Shows internet.email when optional params are omitted.

internet.email()

Returns: Edwin.Dibbert@hotmail.com

Shows internet.email using allowSpecialCharacters.

internet.email(allowSpecialCharacters=true)

Returns: Edwin.Dibbert@hotmail.com

Shows internet.email using firstName.

internet.email(firstName="Ada")

Returns: Ada.Gutmann9@hotmail.com

Shows internet.email using lastName.

internet.email(lastName="Lovelace")

Returns: Edwin.Lovelace9@hotmail.com

Shows internet.email using provider.

internet.email(provider="example.com")

Returns: Aaliyah.Bosco@example.com

internet.emoji

Generates a random emoji.

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

Examples:

Shows internet.emoji when optional params are omitted.

internet.emoji()

Returns: 🥣

Shows internet.emoji using types.

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

Returns: 🍲

internet.exampleEmail

Generates data using faker internet example email.

ArgTypeRequiredDescription
firstNamestringnoOptional first name to use as the basis for the email address.
lastNamestringnoOptional last name to use as the basis for the email address.
allowSpecialCharactersbooleannoWhether special characters are allowed in the generated email address.

Examples:

Shows the default internet.exampleEmail call.

internet.exampleEmail()

Returns: Edwin.Dibbert@example.net

Shows internet.exampleEmail using firstName and lastName options.

internet.exampleEmail(firstName="Ada", lastName="Lovelace")

Returns: Ada_Lovelace0@example.net

Shows internet.exampleEmail allowing special characters.

internet.exampleEmail(allowSpecialCharacters=true)

Returns: Edwin.Dibbert@example.net

Shows internet.exampleEmail using an explicit first name.

internet.exampleEmail(firstName="Ada")

Returns: Ada.Gutmann9@example.net

Shows internet.exampleEmail using an explicit last name.

internet.exampleEmail(lastName="Lovelace")

Returns: Edwin.Lovelace9@example.net

internet.httpMethod

Returns a random HTTP request method from an AnywayData-defined pool of GET, HEAD, POST, PUT, DELETE, PATCH, OPTIONS, TRACE, and CONNECT, with optional filtering for common methods and exclusions.

  • Canonical: awd.domain.internet.httpMethod
ArgTypeRequiredDescription
commonOnlybooleannoWhen true, limits generation to GET, HEAD, POST, PUT, and DELETE. Defaults to false.
excludesstringnoComma-separated HTTP methods to remove from the candidate set. Values are case-insensitive, surrounding spaces are trimmed, and generation throws if exclusions remove every available method.

Examples:

Shows internet.httpMethod choosing from the full HTTP method set by default.

internet.httpMethod()

Returns: PUT

Shows internet.httpMethod restricted to the common request methods.

internet.httpMethod(commonOnly=true)

Returns: POST

Shows internet.httpMethod trimming spaces, normalizing case, and excluding methods from the full set.

internet.httpMethod(excludes="patch, TRACE")

Returns: POST

internet.httpStatusCode

Generates a random HTTP status code.

ArgTypeRequiredDescription
typesarraynoHTTP status categories to choose from. Allowed categories are informational, success, redirection, clientError, and serverError.

Examples:

Shows the default internet.httpStatusCode call.

internet.httpStatusCode()

Returns: 306

Shows internet.httpStatusCode constrained to success status codes.

internet.httpStatusCode(types=["success"])

Returns: 204

internet.ip

Generates a random IPv4 or IPv6 address.

No parameters.

Examples:

Shows the default internet.ip call.

internet.ip

Returns: 184.103.47.157

internet.ipv4

Generates a random IPv4 address.

ArgTypeRequiredDescription
cidrBlockstringnoThe optional CIDR block to use. Must be in the format x.x.x.x/y.
networkany|loopback|private-a|private-b|private-c|test-net-1|test-net-2|test-net-3|link-local|multicastnoThe optional network to use. This is intended as an alias for well-known cidrBlocks.

Examples:

Shows internet.ipv4 when optional params are omitted.

internet.ipv4()

Returns: 106.193.244.63

Shows internet.ipv4 using cidrBlock.

internet.ipv4(cidrBlock="192.168.0.0/24")

Returns: 192.168.0.106

Shows internet.ipv4 using network.

internet.ipv4(network="private-a")

Returns: 10.106.193.244

internet.ipv6

Generates a random IPv6 address.

No parameters.

Examples:

Shows the default internet.ipv6 call.

internet.ipv6

Returns: 9f06:3247:8b9f:4d0e:9c34:bf6f:dd10:3d29

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:

Shows internet.jwt when optional params are omitted.

internet.jwt()

Returns: eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE3ODE3NDc3NTAsImV4cCI6MTc4MTc0Nzc2MSwibmJmIjoxNzY5MzMwODQwLCJpc3MiOiJIZWdtYW5uIC0gSm9obnN0b24iLCJzdWIiOiJhM2UwYTY4Mi0zY2Y1LTRiZWUtYTEwMi1lMTZmOGI1YWQwY2YiLCJhdWQiOiI0YzE3ZTQ0Mi0wYTM0LTQ3MDktODI5Yi0xNmI2MDhhOGY5ZTIiLCJqdGkiOiJjNjJlNWNiZS05YzU0LTRlNmYtOWE5MS1mNzk2M2U5MDk1OGUifQ.UC0VGZa8VH4KKVI7111fRxyQ7hAYy1NeOoRKy83726dIy04XzcfKcAYQeuCP914u

Shows internet.jwt using header.

internet.jwt(header={"value":"sample"})

Returns: eyJ2YWx1ZSI6InNhbXBsZSJ9.eyJpYXQiOjE3ODE3NDc3NTAsImV4cCI6MTc4MTgwOTk4NywibmJmIjoxNzUwMjY5MzM0LCJpc3MiOiJEaWJiZXJ0IC0gTGluZCIsInN1YiI6IjZhM2UwYTY4LTIzY2YtNDViZS1iZTEwLTJlMTZmOGI1YWQwYyIsImF1ZCI6ImI0YzE3ZTQ0LTIwYTMtNDQ3MC04OTI5LWIxNmI2MDhhOGY5ZSIsImp0aSI6IjJjNjJlNWNiLWU5YzUtNDRlNi1iZmE5LTFmNzk2M2U5MDk1OCJ9.mUC0VGZa8VH4KKVI7111fRxyQ7hAYy1NeOoRKy83726dIy04XzcfKcAYQeuCP914

Shows internet.jwt using payload.

internet.jwt(payload={"value":"sample"})

Returns: eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJ2YWx1ZSI6InNhbXBsZSJ9.0i95bloxpGcS1Fpy8cNYjGST52aS6qXxGjGP1KZKhM6rUih81Gdgu3z9AH6pHp3x

Shows internet.jwt using refDate.

internet.jwt(refDate=1718755200000)

Returns: eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE3MTg3MDQ4MzAsImV4cCI6MTcxODcwNDg0MSwibmJmIjoxNzA2Mjg3OTIwLCJpc3MiOiJIZWdtYW5uIC0gSm9obnN0b24iLCJzdWIiOiJhM2UwYTY4Mi0zY2Y1LTRiZWUtYTEwMi1lMTZmOGI1YWQwY2YiLCJhdWQiOiI0YzE3ZTQ0Mi0wYTM0LTQ3MDktODI5Yi0xNmI2MDhhOGY5ZTIiLCJqdGkiOiJjNjJlNWNiZS05YzU0LTRlNmYtOWE5MS1mNzk2M2U5MDk1OGUifQ.UC0VGZa8VH4KKVI7111fRxyQ7hAYy1NeOoRKy83726dIy04XzcfKcAYQeuCP914u

internet.jwtAlgorithm

Generates a random JWT (JSON Web Token) Algorithm.

No parameters.

Examples:

Shows the default internet.jwtAlgorithm call.

internet.jwtAlgorithm

Returns: HS512

internet.mac

Generates a random mac address.

ArgTypeRequiredDescription
separator":"|"-"|""noThe optional separator to use. Can be either ':', '-' or ''.

Examples:

Shows internet.mac when optional params are omitted.

internet.mac()

Returns: 6b:04:21:25:68:6a

Shows internet.mac using separator.

internet.mac(separator="-")

Returns: 6b-04-21-25-68-6a

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:

Shows internet.password with all optional params omitted.

internet.password()

Returns: He2AFTHb4tHV3mb

Shows internet.password using only a custom length.

internet.password(length=12)

Returns: He2AFTHb4tHV

Shows internet.password using only the memorable flag.

internet.password(memorable=true)

Returns: hefutisawetikub

Shows internet.password generating a memorable password-like string.

internet.password(length=12, memorable=true)

Returns: hefutisaweti

Shows internet.password constrained only by a regex-style pattern.

internet.password(pattern="[A-Z]")

Returns: HAFTHHVISKOWXHH

Shows internet.password constrained by a regex-style pattern.

internet.password(length=12, memorable=false, pattern="[A-Z]")

Returns: HAFTHHVISKOW

Shows internet.password using only the prefix option.

internet.password(prefix="#")

Returns: #He2AFTHb4tHV3m

Shows internet.password using length, pattern, and prefix together.

internet.password(length=12, memorable=false, pattern="[A-Z]", prefix="#")

Returns: #HAFTHHVISKO

internet.port

Generates a random port number.

No parameters.

Examples:

Shows the default internet.port call.

internet.port

Returns: 27329

internet.protocol

Returns a random web protocol. Either http or https.

No parameters.

Examples:

Shows the default internet.protocol call.

internet.protocol

Returns: http

internet.url

Generates a random http(s) url.

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

Examples:

Shows internet.url when optional params are omitted.

internet.url()

Returns: https://self-reliant-cd.com/

Shows internet.url using appendSlash.

internet.url(appendSlash=true)

Returns: https://inferior-punctuation.biz/

Shows internet.url using protocol.

internet.url(protocol="https")

Returns: https://self-reliant-cd.com/

internet.userAgent

Generates a random user agent string.

No parameters.

Examples:

Shows the default internet.userAgent call.

internet.userAgent

Returns: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/586.0.30 (KHTML, like Gecko) Version/16.1 Safari/546.9.18

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:

Shows internet.username when optional params are omitted.

internet.username()

Returns: Aaliyah.Bosco

Shows internet.username using firstName.

internet.username(firstName="Ada")

Returns: Ada.Abbott14

Shows internet.username using lastName.

internet.username(lastName="Lovelace")

Returns: Aaliyah.Lovelace14