Home
Softono

Requests Random User Agent

Open source MIT Python
77
Stars
23
Forks
6
Issues
1
Watchers
1 year
Last Commit

 About Requests Random User Agent

Configures the requests library to randomly select a desktop User-Agent

Platforms

Web Self-hosted

Languages

Python

Links

Need Help Installing Requests Random User Agent?

We provide expert installation service for this software. Our team will install, configure, and secure Requests Random User Agent on your server. plans start at just $30.

Requests Random User Agent

View on GitHub

requests-random-user-agent Build Status PyPI

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.