Skip to main content

Automatically generate a random User Agent for the requests library

Project description

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

requests_random_user_agent-2022.11.12.tar.gz (45.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

requests_random_user_agent-2022.11.12-py3-none-any.whl (46.9 kB view details)

Uploaded Python 3

File details

Details for the file requests_random_user_agent-2022.11.12.tar.gz.

File metadata

File hashes

Hashes for requests_random_user_agent-2022.11.12.tar.gz
Algorithm Hash digest
SHA256 b0306cc53a95ded832bf967012d70ee9abf51af4eac6dc1e93776cac4067c2b7
MD5 21ac1056d0107909a6d7e4473ae09144
BLAKE2b-256 ee8643a2d51828f072367a709f71ddda94019cbdea45ba044e1070c422174a49

See more details on using hashes here.

File details

Details for the file requests_random_user_agent-2022.11.12-py3-none-any.whl.

File metadata

File hashes

Hashes for requests_random_user_agent-2022.11.12-py3-none-any.whl
Algorithm Hash digest
SHA256 10fbd1c3f8492390df95d6e002aaeda27cf99b554aef9588b829e6be0f36a7f7
MD5 e92b97ab6fc9815501fa4f2e7a99345c
BLAKE2b-256 5a521102b876d178da837ec208ca789b1f11f459627d7a2620f36b2fd7d726fc

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page