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-2020.12.4.tar.gz (45.0 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-2020.12.4.tar.gz.

File metadata

  • Download URL: requests_random_user_agent-2020.12.4.tar.gz
  • Upload date:
  • Size: 45.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.54.0 CPython/3.6.7

File hashes

Hashes for requests_random_user_agent-2020.12.4.tar.gz
Algorithm Hash digest
SHA256 32fa33dd05ec3649dac8fc8fb2c473d968464832d4f5073650b563f1c5d2e2f4
MD5 6bc85e0734775aad9fc4aedb21f7ce45
BLAKE2b-256 8119cdf6b479a0a783267cbf51767112f9a12e988992378d35b3d691b37724b1

See more details on using hashes here.

File details

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

File metadata

  • Download URL: requests_random_user_agent-2020.12.4-py3-none-any.whl
  • Upload date:
  • Size: 47.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.54.0 CPython/3.6.7

File hashes

Hashes for requests_random_user_agent-2020.12.4-py3-none-any.whl
Algorithm Hash digest
SHA256 c18892fa08f37c1e48f2a2e70d47568a50262655a1fe4278a3236fa94c222b4b
MD5 74761c31ccec7c7fc3a0d0af714f80fd
BLAKE2b-256 0c9198a11c5b034d4f1a0184a69d9a621cb7a92a0506a14351d6890316d32771

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