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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file requests_random_user_agent-2023.10.25.tar.gz.
File metadata
- Download URL: requests_random_user_agent-2023.10.25.tar.gz
- Upload date:
- Size: 45.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.9.21
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ecc95f95b8da16ef38ed479f9faa21b9bfbd49ebea55d8c0ad042e0b64b74d26
|
|
| MD5 |
e0cb58f8280cdc888e18e7a9a9bce28e
|
|
| BLAKE2b-256 |
d406313161c85c087b95c4ce357dddaf065076eaf2463b06320a2ef47bc5b6c1
|
File details
Details for the file requests_random_user_agent-2023.10.25-py3-none-any.whl.
File metadata
- Download URL: requests_random_user_agent-2023.10.25-py3-none-any.whl
- Upload date:
- Size: 47.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.9.21
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f4f4f7c23c317e3a8d5485c56e9e4000fe4dd2bfec308f151a6ff7a32189a99c
|
|
| MD5 |
4389971365859e0144affe0423d51912
|
|
| BLAKE2b-256 |
08cb91555e856333e19e0ace665245642f90c4112ea471eb81523784d2032105
|