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.9.7.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 83323d471aa473398e8114c3eb7fddd62b3002f459ebfabd0494c2be61ce1b14 |
|
MD5 | 846684763415b044a37e444604dd0695 |
|
BLAKE2b-256 | a3b03407caf6f6a67aa97737e9a72f368c944b72e18a8983a0fd514e1b130bdf |
Close
Hashes for requests_random_user_agent-2022.9.7-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b427e7a8ad127294e6ae83bca234d62c0e1972ef1a1b1d19c3f6fddc9c29ef42 |
|
MD5 | 8e6e486120e42dfe5e998b0350af5aba |
|
BLAKE2b-256 | 28408f71f63e69977b7919953e7801ae65e33d1cbd865b56cb5aa90c9a7398b8 |