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.8.27.tar.gz (45.3 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.8.27-py3-none-any.whl (47.2 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for requests_random_user_agent-2022.8.27.tar.gz
Algorithm Hash digest
SHA256 0e119faf455ccf7b415f26eb1087ec30549b81e895197dd1ea77a6b9b8c5d4e9
MD5 62efff1443080ae67a1649d3be4f42f4
BLAKE2b-256 42863e2a7a205d6dc67555a78f28148d136bc5bf0c1b9b2ec374385975c68977

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for requests_random_user_agent-2022.8.27-py3-none-any.whl
Algorithm Hash digest
SHA256 239c1c0b15d15593a431c484aec78ead6364aeb536963cea583366ce0c0bf495
MD5 cc3f2552c6ceca3e2d00f9bd05e6a8fb
BLAKE2b-256 9ce151934b503956f08b80837fd1fb9d8ac7a104ce0fe9a37d4e1a4e0765dad8

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