Metadata-Version: 2.1
Name: requests_random_user_agent
Version: 2022.8.27
Summary: Automatically generate a random User Agent for the requests library
Home-page: https://github.com/DavidWittman/requests-random-user-agent
Author: David Wittman
Author-email: david@wittman.com
Classifier: Programming Language :: Python :: 3
Classifier: Operating System :: OS Independent
Description-Content-Type: text/markdown
License-File: LICENSE

# requests-random-user-agent [![Build Status](https://travis-ci.org/DavidWittman/requests-random-user-agent.svg?branch=master)](https://travis-ci.org/DavidWittman/requests-random-user-agent) [![PyPI](https://img.shields.io/pypi/v/requests-random-user-agent.svg)](https://pypi.org/project/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](requests_random_user_agent/useragents.txt).

### Installation

```
pip install requests-random-user-agent
```

### Usage

``` python
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](requests_random_user_agent/android_useragents.txt) instead. List provided by [WhatIsMyBrowser](whatismybrowser.com).
