Automatically generate a random User Agent for the requests library
Project description
requests-random-user-agent
Configures the requests library to randomly select a desktop User-Agent. See the full list in requests_random_user_agent/useragents.txt.
Installation
pip install requests-random-user-agent
Usage
import requests
import requests_random_user_agent
s = requests.Session()
print(s.headers['User-Agent'])
# Without a session
resp = requests.get('https://httpbin.org/user-agent')
print(resp.json()['user-agent'])
User-Agents are randomized per-session or per-request. Individual HTTP requests without a session will each have a random User-Agent selected from the list in useragents.txt.
Android User-Agents
Set the environment variable UA_PLATFORM=android
to use a list of Android-specific User-Agents instead. List provided by WhatIsMyBrowser.
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
Built Distribution
Close
Hashes for requests_random_user_agent-2022.6.25.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7f9bacfbba2d2036b09bfe01ecf42ad9eab2d40726fa9f89568440a7b3c11ec6 |
|
MD5 | 6ddd4a59a64b572100095630b05a4239 |
|
BLAKE2b-256 | f77c588928718e4480e38acceb904c9b4f7537868155775c02fefde7c52c5cc8 |
Close
Hashes for requests_random_user_agent-2022.6.25-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1983c85d0af6fe3c537b54b202a2a1e473bc26c2c1ebd43fec6bec41eab6afad |
|
MD5 | 490afee9813e6dee7894e014e27aef3f |
|
BLAKE2b-256 | 34efa41d671982ac9b129bb7e39f045559ce4410df351491c9c481e832d0855a |