A random user-agent generator
Project description
ua-generator
A random user-agent generator for Python >= 3.6
Features
- No external user-agent list. No downloads.
- Templates are hardcoded into the code.
- Platform and browser versions are based on real releases.
- Client hints (Sec-CH-UA fields).
Installing
pip3 install -U ua-generator
Basic usage
import ua_generator
ua = ua_generator.generate()
print(ua) # Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_3) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/15.2 Safari/604.1.38
Customization
There are three different parameters to the generate user-agent by the certain conditions.
device = ('desktop', 'mobile')
platform = ('windows', 'macos', 'ios', 'linux', 'android')
browser = ('chrome', 'edge', 'firefox', 'safari')
All of the parameters are optional, and the types can be choose multiple.
import ua_generator
ua = ua_generator.generate(device='desktop', browser='firefox')
print(ua.text) # Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:85.0) Gecko/20100101 Firefox/85.0
print(ua.platform) # linux
print(ua.browser) # firefox
print(ua.ch.brands) # " Not A;Brand";v="99"
print(ua.ch.mobile) # ?0
ua = ua_generator.generate(platform=('ios', 'macos'), browser='chrome')
print(ua.text) # Mozilla/5.0 (iPhone; CPU iPhone OS 15_4 like Mac OS X) AppleWebKit/537.36 (KHTML, like Gecko) CriOS/80.0.3987.44 Mobile/15E148 Safari/537.36
print(ua.platform) # ios
print(ua.browser) # chrome
print(ua.ch.brands) # " Not A;Brand";v="99", "Chromium";v="80", "Google Chrome";v="80"
print(ua.ch.mobile) # ?1
Author
Ekin Karadeniz (iamdual@icloud.com)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
ua-generator-0.1.10.tar.gz
(16.8 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ua-generator-0.1.10.tar.gz.
File metadata
- Download URL: ua-generator-0.1.10.tar.gz
- Upload date:
- Size: 16.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
84a84e9b5c72e97d744e59e5fb9db5278c714d0ab24062dd2dfeea9c2a016c8b
|
|
| MD5 |
9282f93910ec71e43edc33ee4f81b412
|
|
| BLAKE2b-256 |
189b8061e021665e4e512067ad51ce2bd37eb9fb32270e9c7c9f5e7ca1b6da31
|
File details
Details for the file ua_generator-0.1.10-py3-none-any.whl.
File metadata
- Download URL: ua_generator-0.1.10-py3-none-any.whl
- Upload date:
- Size: 21.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b6dfd858cabfb5698f4c48217c06c28bee9bbae5e3a0961deff9a1b8399935c8
|
|
| MD5 |
dac700b2c1584a9b11c0cec74a176cc7
|
|
| BLAKE2b-256 |
de33b0153c2471c7d1cf1c3925d8be9980e6b9b09c700638aa8b73e7672d1c41
|