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.5.tar.gz (45.1 kB view details)

Uploaded Source

Built Distribution

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

File details

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

File metadata

File hashes

Hashes for requests_random_user_agent-2022.11.5.tar.gz
Algorithm Hash digest
SHA256 f3d4e2e4635dd820d594663331131e9b95eea76a6e55ba34707f4e9e94966516
MD5 9675c197d905c8670f13982c2cedee15
BLAKE2b-256 5584235f4e8ff4c5f41a34c8b1357a8c48d40a042b7e3512bbc05a694ac57fe8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for requests_random_user_agent-2022.11.5-py3-none-any.whl
Algorithm Hash digest
SHA256 2a703a09854054020618412f67d6a6fe5f292335ddb449f77299cf25a1167108
MD5 e39a73a9c6a0e8e33d9008b1721744f5
BLAKE2b-256 559f1d0ba27f8c076c4d497954bd132235e060b52c916606702524df59e4639e

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