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.10.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 02bf80575e33bfe23f000d6ab51f41d1ba5fe88cb519f7b81892fb9672783695 |
|
MD5 | e02e2f0b1346369b2cc2f680c0e6dafb |
|
BLAKE2b-256 | e41f25c1a3d11ce9458b4d53646f0928cce405e0aea1d49f338ad7611698c9c7 |
Close
Hashes for requests_random_user_agent-2022.6.10-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f7ca7b3835144516a061de7c4a6a4be02f72b9f2483aee5e720efc6614e5af0d |
|
MD5 | f6cdbca1add170231f65fa59cf8b21a1 |
|
BLAKE2b-256 | 0ed9925814fdb3a834bde6a459e6fcc4fd8cbe10b2fd073032ba9923e9358418 |