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-2023.1.13.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | adee7e99cd87f37b29c57813e1c6441e3112c8df87bcc3074bed5372221e2297 |
|
MD5 | f62da5d9d9647546cd31705873d65740 |
|
BLAKE2b-256 | 2bdc5abc931406f07b3c182c6135d7572ef5a68f25d92a59db0c8f687ca74fc3 |
Close
Hashes for requests_random_user_agent-2023.1.13-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e3b4673ffcdff77c035730aa1bca99a71de4dac711e9459ccbd0c74a857ca3d0 |
|
MD5 | 5e4777c202075af6f52743e33f16597e |
|
BLAKE2b-256 | 12efb15e4b28483d01cc9753921d8f87ba4b6cdd257d08790348ef18f20b09c9 |