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.18.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.

requests_random_user_agent-2021.5.18-py3-none-any.whl (47.2 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for requests_random_user_agent-2021.5.18.tar.gz
Algorithm Hash digest
SHA256 ecda5cc1676b91957442b8d1dc7d8a91ad87195f93f501a91ddf89d4490f86e4
MD5 fb3b06a6b92ed53c1ff7b0a27000017f
BLAKE2b-256 bec312730fbc495cf987a21b70f563796f84e38dcf6860e913b19ff0adff42e1

See more details on using hashes here.

File details

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

File metadata

  • Download URL: requests_random_user_agent-2021.5.18-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.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.6.7

File hashes

Hashes for requests_random_user_agent-2021.5.18-py3-none-any.whl
Algorithm Hash digest
SHA256 a356fc54a1f5da1f40bd0b3e012365ea43574ae79f79871c961800933360ee2d
MD5 34578d02b127a44425990e83422756c6
BLAKE2b-256 8c71425be53d4028a7f2e96174dfe25319ff8f601cceba54c5c6058fb13966a0

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