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

Uploaded Source

Built Distribution

File details

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

File metadata

File hashes

Hashes for requests_random_user_agent-2023.2.15.tar.gz
Algorithm Hash digest
SHA256 5763169f01e5568d03d1442581d77323ce1333dcdb69a7834acd5b2f767c548e
MD5 1510613520ac04e10c1dc0771f2d12a3
BLAKE2b-256 6adc305960124ac0b19e2d50c879520a1e4d646d10509722491fce6026e85a72

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for requests_random_user_agent-2023.2.15-py3-none-any.whl
Algorithm Hash digest
SHA256 41157180200934098ca7c2dc0daac80bdd27cbe43e2cfeaa35324a42fc2af088
MD5 18325a730e3c9f6cc5f1d8b93ec7eb77
BLAKE2b-256 a0f1e5875f7bc416b90216ad029ff9a08ea4667ccd6ce34c2f98dd8d72db47e6

See more details on using hashes here.

Supported by

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