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.5.29.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | ee222514ab3b061ecb0d1fb110692a5c900306a18b66558f49aca5f861a7f4ed |
|
MD5 | e4095e18ff6c8cb2d4dc649eace11899 |
|
BLAKE2b-256 | b55dfec2c23c3ba474242f144d1dc4aaf114ce24b52f637461a9095821809c25 |
Close
Hashes for requests_random_user_agent-2021.5.29-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8589fa803ed2936ad8c9a63c419dc10520aeb4b6848f4d307b98252c83633980 |
|
MD5 | 2726e0610351fdacdf50ca84ecc47822 |
|
BLAKE2b-256 | 2c71f13d2ae7cc5cf595a5e5bf51fefa3e3de2a77972ca8f456d5bb0e816a441 |