faker.providers.user_agent

class faker.providers.user_agent.Provider(generator: Any)

Bases: BaseProvider

Implement default user agent provider for Faker.

android_platform_token() str

Generate an Android platform token used in user agent strings.

Examples:

>>> Faker.seed(0)
>>> for _ in range(5):
...     fake.android_platform_token()
...
'Android 5.1'
'Android 7.0'
'Android 2.0.1'
'Android 4.1'
'Android 14'
chrome(version_from: int = 13, version_to: int = 63, build_from: int = 800, build_to: int = 899) str

Generate a Chrome web browser user agent string.

Examples:

>>> Faker.seed(0)
>>> for _ in range(5):
...     fake.chrome()
...
'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/534.1 (KHTML, like Gecko) Chrome/43.0.845.0 Safari/534.1'
'Mozilla/5.0 (X11; Linux i686) AppleWebKit/536.1 (KHTML, like Gecko) Chrome/48.0.861.0 Safari/536.1'
'Mozilla/5.0 (Linux; Android 3.2.5) AppleWebKit/532.2 (KHTML, like Gecko) Chrome/51.0.870.0 Safari/532.2'
'Mozilla/5.0 (iPad; CPU iPad OS 17_4 like Mac OS X) AppleWebKit/533.2 (KHTML, like Gecko) CriOS/28.0.827.0 Mobile/34B232 Safari/533.2'
'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/534.2 (KHTML, like Gecko) Chrome/34.0.824.0 Safari/534.2'
firefox() str

Generate a Mozilla Firefox web browser user agent string.

Examples:

>>> Faker.seed(0)
>>> for _ in range(5):
...     fake.firefox()
...
'Mozilla/5.0 (Windows NT 10.0; tg-TJ; rv:1.9.1.20) Gecko/8757-01-31 06:04:54.973633 Firefox/10.0'
'Mozilla/5.0 (Windows NT 10.0; dz-BT; rv:1.9.0.20) Gecko/8442-05-13 14:26:54.212433 Firefox/12.0'
'Mozilla/5.0 (iPad; CPU iPad OS 6_1_6 like Mac OS X) AppleWebKit/532.0 (KHTML, like Gecko) FxiOS/16.2v2018.0 Mobile/09C471 Safari/532.0'
'Mozilla/5.0 (Android 2.0; Mobile; rv:7.0) Gecko/7.0 Firefox/7.0'
'Mozilla/5.0 (Windows NT 6.0; ckb-IQ; rv:1.9.0.20) Gecko/9496-05-18 23:28:27.270996 Firefox/3.6.1'
internet_explorer() str

Generate an IE web browser user agent string.

Examples:

>>> Faker.seed(0)
>>> for _ in range(5):
...     fake.internet_explorer()
...
'Mozilla/5.0 (compatible; MSIE 8.0; Windows NT 10.0; Trident/4.0)'
'Mozilla/5.0 (compatible; MSIE 7.0; Windows NT 5.2; Trident/4.1)'
'Mozilla/5.0 (compatible; MSIE 7.0; Windows NT 5.1; Trident/4.0)'
'Mozilla/5.0 (compatible; MSIE 9.0; Windows 98; Win 9x 4.90; Trident/4.0)'
'Mozilla/5.0 (compatible; MSIE 5.0; Windows NT 6.0; Trident/4.0)'
ios_platform_token() str

Generate an iOS platform token used in user agent strings.

Examples:

>>> Faker.seed(0)
>>> for _ in range(5):
...     fake.ios_platform_token()
...
'iPad; CPU iPad OS 17_1 like Mac OS X'
'iPhone; CPU iPhone OS 12_4_8 like Mac OS X'
'iPad; CPU iPad OS 16_7_7 like Mac OS X'
'iPad; CPU iPad OS 17_2_1 like Mac OS X'
'iPad; CPU iPad OS 10_3_4 like Mac OS X'
linux_platform_token() str

Generate a Linux platform token used in user agent strings.

Examples:

>>> Faker.seed(0)
>>> for _ in range(5):
...     fake.linux_platform_token()
...
'X11; Linux x86_64'
'X11; Linux x86_64'
'X11; Linux i686'
'X11; Linux x86_64'
'X11; Linux x86_64'
linux_processor() str

Generate a Linux processor token used in user agent strings.

Examples:

>>> Faker.seed(0)
>>> for _ in range(5):
...     fake.linux_processor()
...
'x86_64'
'x86_64'
'i686'
'x86_64'
'x86_64'
mac_platform_token() str

Generate a MacOS platform token used in user agent strings.

Examples:

>>> Faker.seed(0)
>>> for _ in range(5):
...     fake.mac_platform_token()
...
'Macintosh; U; PPC Mac OS X 10_11_0'
'Macintosh; U; Intel Mac OS X 10_12_6'
'Macintosh; U; Intel Mac OS X 10_12_5'
'Macintosh; PPC Mac OS X 10_7_4'
'Macintosh; PPC Mac OS X 10_6_9'
mac_processor() str

Generate a MacOS processor token used in user agent strings.

Examples:

>>> Faker.seed(0)
>>> for _ in range(5):
...     fake.mac_processor()
...
'U; PPC'
'U; PPC'
'Intel'
'U; Intel'
'U; PPC'
opera() str

Generate an Opera web browser user agent string.

Examples:

>>> Faker.seed(0)
>>> for _ in range(5):
...     fake.opera()
...
'Opera/9.61.(X11; Linux x86_64; mt-MT) Presto/2.9.168 Version/12.00'
'Opera/8.46.(X11; Linux x86_64; os-RU) Presto/2.9.178 Version/10.00'
'Opera/8.49.(Windows NT 10.0; ce-RU) Presto/2.9.189 Version/12.00'
'Opera/8.55.(Windows NT 6.2; bo-IN) Presto/2.9.175 Version/12.00'
'Opera/9.66.(Windows NT 5.0; the-NP) Presto/2.9.190 Version/12.00'
safari() str

Generate a Safari web browser user agent string.

Examples:

>>> Faker.seed(0)
>>> for _ in range(5):
...     fake.safari()
...
'Mozilla/5.0 (iPod; U; CPU iPhone OS 4_1 like Mac OS X; mn-MN) AppleWebKit/534.49.4 (KHTML, like Gecko) Version/3.0.5 Mobile/8B115 Safari/6534.49.4'
'Mozilla/5.0 (iPod; U; CPU iPhone OS 4_3 like Mac OS X; om-ET) AppleWebKit/535.10.3 (KHTML, like Gecko) Version/4.0.5 Mobile/8B111 Safari/6535.10.3'
'Mozilla/5.0 (iPod; U; CPU iPhone OS 3_1 like Mac OS X; the-NP) AppleWebKit/531.6.6 (KHTML, like Gecko) Version/3.0.5 Mobile/8B113 Safari/6531.6.6'
'Mozilla/5.0 (iPod; U; CPU iPhone OS 3_2 like Mac OS X; pl-PL) AppleWebKit/534.6.1 (KHTML, like Gecko) Version/4.0.5 Mobile/8B112 Safari/6534.6.1'
'Mozilla/5.0 (iPod; U; CPU iPhone OS 3_1 like Mac OS X; fr-CH) AppleWebKit/534.21.5 (KHTML, like Gecko) Version/3.0.5 Mobile/8B112 Safari/6534.21.5'
user_agent() str

Generate a random web browser user agent string.

Examples:

>>> Faker.seed(0)
>>> for _ in range(5):
...     fake.user_agent()
...
'Opera/9.61.(X11; Linux x86_64; az-IN) Presto/2.9.190 Version/12.00'
'Mozilla/5.0 (compatible; MSIE 8.0; Windows NT 5.0; Trident/5.0)'
'Mozilla/5.0 (iPod; U; CPU iPhone OS 3_2 like Mac OS X; ht-HT) AppleWebKit/532.19.2 (KHTML, like Gecko) Version/4.0.5 Mobile/8B116 Safari/6532.19.2'
'Mozilla/5.0 (Windows CE; dz-BT; rv:1.9.0.20) Gecko/9733-03-20 00:27:42.407959 Firefox/11.0'
'Mozilla/5.0 (iPod; U; CPU iPhone OS 3_1 like Mac OS X; fr-CH) AppleWebKit/534.21.5 (KHTML, like Gecko) Version/3.0.5 Mobile/8B112 Safari/6534.21.5'
windows_platform_token() str

Generate a Windows platform token used in user agent strings.

Examples:

>>> Faker.seed(0)
>>> for _ in range(5):
...     fake.windows_platform_token()
...
'Windows NT 11.0'
'Windows NT 5.01'
'Windows NT 10.0'
'Windows NT 5.01'
'Windows 95'