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

Uploaded Python 3

File details

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

File metadata

  • Download URL: requests_random_user_agent-2021.5.29.tar.gz
  • Upload date:
  • Size: 44.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.3.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.6.7

File hashes

Hashes for requests_random_user_agent-2021.5.29.tar.gz
Algorithm Hash digest
SHA256 ee222514ab3b061ecb0d1fb110692a5c900306a18b66558f49aca5f861a7f4ed
MD5 e4095e18ff6c8cb2d4dc649eace11899
BLAKE2b-256 b55dfec2c23c3ba474242f144d1dc4aaf114ce24b52f637461a9095821809c25

See more details on using hashes here.

File details

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

File metadata

  • Download URL: requests_random_user_agent-2021.5.29-py3-none-any.whl
  • Upload date:
  • Size: 47.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.3.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.6.7

File hashes

Hashes for requests_random_user_agent-2021.5.29-py3-none-any.whl
Algorithm Hash digest
SHA256 8589fa803ed2936ad8c9a63c419dc10520aeb4b6848f4d307b98252c83633980
MD5 2726e0610351fdacdf50ca84ecc47822
BLAKE2b-256 2c71f13d2ae7cc5cf595a5e5bf51fefa3e3de2a77972ca8f456d5bb0e816a441

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