Randomly generates a useragent for fetching a web page without a browser.
Project description
Randomly generate a fake useragent. Supported browsers are: chrome, edge, firefox, safari, and opera.
As a binary
fakeua # Get a useragent without a browser name
fakeua [browser] # Get a useragent with a browser name (case insensitive)
fakeua [browser] --debug # Get a useragent in debug mode
fakeua [browser] --nocache # Get a useragent without using local cache
fakeua --remove # Remove cache from $HOME/.cache/fakeua folder
fakeua --version # Print the current version of the program
As a library
from fake_user_agent import user_agent
# Every time you run the script, the useragent value will be different.
# Not to specify a browser
ua = user_agent()
# Or specify a browser to randomly choose from
ua = user_agent(browser="chrome")
# `use_cache=True` by default.
# It takes less than 2s for the first run, including fetching, parsing, and writing cache.
# It takes less than 0.01s starting from the second time by using cache.
# `use_cache=False` not to use cache.
ua = user_agent(use_cache=False)
# If there is an async function needing a useragent in your script,
# don't put `user_agent()` in your async function, put it above instead.
# Remove cache.
from fake_user_agent import rm_cache
rm_cache()
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
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
fake_user_agent-2.1.9.tar.gz
(4.9 kB
view details)
Built Distribution
File details
Details for the file fake_user_agent-2.1.9.tar.gz
.
File metadata
- Download URL: fake_user_agent-2.1.9.tar.gz
- Upload date:
- Size: 4.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.32.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b30c7f4c9811362331b238d1b0e5753a026c4205d99bc124c868783d3b14e9bb |
|
MD5 | dfbcc6cac92fd6ead29370dbf687245d |
|
BLAKE2b-256 | c761c8fc42087006cab9775d877b8a1d204455283d87c9336aeaca644ebfe499 |
File details
Details for the file fake_user_agent-2.1.9-py3-none-any.whl
.
File metadata
- Download URL: fake_user_agent-2.1.9-py3-none-any.whl
- Upload date:
- Size: 6.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.32.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c5d71f1da407cadc1d7b4ad22983e08b3d0d7073d32aeb1d62ce6d8c0af3e92b |
|
MD5 | bd7f3627868d238a7bad18353ff925cb |
|
BLAKE2b-256 | 63a470f2f30ec93ee6f4973418b81d4d7bb7485ac21ac0c34110f0e45ac2dc99 |