Randomly generate a valid useragent for faking a browser.
Supported browsers are: "chrome", "edge", "firefox", "safari", and "opera" (case insensitive).
As a binary
fakeua # randomize a useragent (using cache by default)
fakeua [browser] # randomize a useragent of a specified browser
fakeua [browser] --debug # randomize a useragent in debug mode
fakeua [browser] --nocache # randomize a useragent by fetching the web
fakeua [browser] --cache # randomize a useragent by using cache other than the default one
fakeua --load <cache_path> # load up-to-date useragent versions as cache to specified file path
fakeua --remove <cache_path> # remove cache at specified file path
fakeua --version # print the current version of the program
As a library
# No error handling is needed.
# The following functions return a valid randomized useragent definitely.
# Resort to a fixed useragent in the event of an error when reading cache
# to avoid breaking the caller. In such case, turn on logging debug mode to inspect.
# `CACHE_FILE` defaults to `$HOME/.cache/fakeua/fake_useragent.json`.
# a different cache file is supported, which can be generated by:
# 1. running on terminal: fakeua --load <cache_path>
# 2. calling in script: `await dump(cache_path)`
# For non-async caller:
from fake_user_agent import user_agent
ua = user_agent(browser=None, use_cache=True, cache_path=CACHE_FILE)
# For async caller:
from fake_user_agent import aio_user_agent
ua = await aio_user_agent(browser=None, use_cache=True, cache_path=CACHE_FILE)
Install & Uninstall
pip install fake_user_agent
pip uninstall -r requirements.txt -y
rm -rf $HOME/.cache/fakeua
# within the project
make install
make uninstall
make clean_cache
Release files for fake_user_agent 2.3.9
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| fake_user_agent-2.3.9.tar.gz | 5.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| fake_user_agent-2.3.9-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 10.7 kB
Release files / fake_user_agent-2.3.9.tar.gz
| Download URL | fake_user_agent-2.3.9.tar.gz |
|---|---|
| Size | 5.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f6fbb2c657b94d547039a5ef1f8240162c54a24f5497aaf24273ab669197d4f4
|
|
BLAKE2b-256 checksum How to use checksums |
11a6165a1013066c70efa5347d210fad7a2b44c2df53591524cc3bee746f01d2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-requests/2.32.3
|
Release files / fake_user_agent-2.3.9-py3-none-any.whl
| Download URL | fake_user_agent-2.3.9-py3-none-any.whl |
|---|---|
| Size | 5.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
bbf3dc2b37dea6d01b41c872c115f48f241888112a44d50540412d0c1b4e29dd
|
|
BLAKE2b-256 checksum How to use checksums |
26f750e5357c2605228bda9f64b719940bd380357893612f1ca54af0d5fba2a1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-requests/2.32.3
|