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.8.27.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0e119faf455ccf7b415f26eb1087ec30549b81e895197dd1ea77a6b9b8c5d4e9 |
|
MD5 | 62efff1443080ae67a1649d3be4f42f4 |
|
BLAKE2b-256 | 42863e2a7a205d6dc67555a78f28148d136bc5bf0c1b9b2ec374385975c68977 |
Close
Hashes for requests_random_user_agent-2022.8.27-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 239c1c0b15d15593a431c484aec78ead6364aeb536963cea583366ce0c0bf495 |
|
MD5 | cc3f2552c6ceca3e2d00f9bd05e6a8fb |
|
BLAKE2b-256 | 9ce151934b503956f08b80837fd1fb9d8ac7a104ce0fe9a37d4e1a4e0765dad8 |