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-2023.10.25.tar.gz (45.9 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-2023.10.25-py3-none-any.whl (47.1 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for requests_random_user_agent-2023.10.25.tar.gz
Algorithm Hash digest
SHA256 ecc95f95b8da16ef38ed479f9faa21b9bfbd49ebea55d8c0ad042e0b64b74d26
MD5 e0cb58f8280cdc888e18e7a9a9bce28e
BLAKE2b-256 d406313161c85c087b95c4ce357dddaf065076eaf2463b06320a2ef47bc5b6c1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for requests_random_user_agent-2023.10.25-py3-none-any.whl
Algorithm Hash digest
SHA256 f4f4f7c23c317e3a8d5485c56e9e4000fe4dd2bfec308f151a6ff7a32189a99c
MD5 4389971365859e0144affe0423d51912
BLAKE2b-256 08cb91555e856333e19e0ace665245642f90c4112ea471eb81523784d2032105

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