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.18.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | ecda5cc1676b91957442b8d1dc7d8a91ad87195f93f501a91ddf89d4490f86e4 |
|
MD5 | fb3b06a6b92ed53c1ff7b0a27000017f |
|
BLAKE2b-256 | bec312730fbc495cf987a21b70f563796f84e38dcf6860e913b19ff0adff42e1 |
Close
Hashes for requests_random_user_agent-2021.5.18-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a356fc54a1f5da1f40bd0b3e012365ea43574ae79f79871c961800933360ee2d |
|
MD5 | 34578d02b127a44425990e83422756c6 |
|
BLAKE2b-256 | 8c71425be53d4028a7f2e96174dfe25319ff8f601cceba54c5c6058fb13966a0 |