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

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for requests_random_user_agent-2022.6.7.tar.gz
Algorithm Hash digest
SHA256 59ac8958e4ee254397af5c8b05d84e8b67b0d81186f6b1a82f19c64d14bf3761
MD5 200c1d6aee7708f9fee724472f989e8c
BLAKE2b-256 9200f5acba96b16e3503ec2c324daa74eb8149fff1b71888e9d262898e12792d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for requests_random_user_agent-2022.6.7-py3-none-any.whl
Algorithm Hash digest
SHA256 250291592568c92ba318a1e9f907952bdfae8dc2daaadd48a3e20a4a185bae02
MD5 0851c4b5afa5983c201560197b0ed6a8
BLAKE2b-256 fef6990958f6eb4b255bbe2d7e647622a432b270d611622232ebcc591c5a09a2

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