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-2021.4.10.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 67ef10ab53e6c929f31eca3bb46494b9ff398dae638f0144e9ba73bc2902dfaa |
|
MD5 | 64ac180c09601a2a7a158b197a060509 |
|
BLAKE2b-256 | 6f673406d22a7fb4780b98c1a42e76b154af2c3555ffe7c77d864baff11b8611 |
Close
Hashes for requests_random_user_agent-2021.4.10-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | adfb24c00be1074eca52ac869cba1aad2a64225e96a9500acaa173c00e5029ef |
|
MD5 | 79929c70c60b90836039e3e0830191f0 |
|
BLAKE2b-256 | d921a4c4adc99efa538b026eea67cbbc0bce150c9d75a41787d5b12cea092209 |