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-2020.12.20.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | c0e7eb813d9b164408cb5691450ba86a553deee5ceba80dce3953ee4731c314d |
|
MD5 | 22e8d8ec921a7ba7751d55da206a19b5 |
|
BLAKE2b-256 | 2e38de38267010d5517685efdcf8f4fc3edd26283e6dae524c9a9b002fe4a271 |
Close
Hashes for requests_random_user_agent-2020.12.20-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 117b089fd3b8e2881298488ece36d94834d189d73ff08a8497b26731ee0a0e4f |
|
MD5 | 2e92b4f8ab096371a8846cf573411fc0 |
|
BLAKE2b-256 | 42f5fae8d147d172f334fbda8562fd6dbfcb18acf982bd5f8db8d74fff348827 |