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.6.4.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2a62a045e94d5a547e1218003524cf8563565f6bcc51535ee5eecbef8235f9ee |
|
MD5 | 8b2b95891b562bc4c8a0489a7fbf08bb |
|
BLAKE2b-256 | 391d664206364f690d977564c74e377d70f582f6844a40412ffea1a69f0edc88 |
Close
Hashes for requests_random_user_agent-2022.6.4-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c70e76bf62f65475ee5b580bebcec4490800a17ada768849e5c94b5f4107500b |
|
MD5 | bd776aeace51c5de28e6c210af48d7d4 |
|
BLAKE2b-256 | e3f1fdde3e9c658825252fc575d5b4d75eacf8403893b877bc2d8e106342f0a9 |