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
Close
Hashes for requests_random_user_agent-2022.5.21.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | a43ac7689c6e69d08e5d6078ce5b3662974d6ed27936169f4e50d2c6db19b5f0 |
|
MD5 | 1909bde76e0b69de54f13fc31ec7473e |
|
BLAKE2b-256 | 0280487a2ca9ae7f960c82a97bcab5fe7df1d043ff9818d552489311ec5fecef |