Skip to main content

User-Agent generator

Project description

https://travis-ci.org/lorien/user_agent.png?branch=master https://img.shields.io/pypi/dm/user_agent.svg https://img.shields.io/pypi/v/user_agent.svg https://readthedocs.org/projects/user_agent/badge/?version=latest

What is user_agent module for?

This module is for generating random, valid web user agents:

  • content of “User-Agent” HTTP headers

  • content of window.navigator JavaScript object

Usage Example

>>> from user_agent import generate_user_agent, generate_navigator
>>> from pprint import pprint
>>> generate_user_agent()
'Mozilla/5.0 (compatible; MSIE 8.0; Windows NT 6.3; Win64; x64)'
>>> generate_user_agent(platform=('mac', 'linux'))
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:36.0) Gecko/20100101 Firefox/36.0'
>>> pprint(generate_navigator())
{'app_code_name': 'Mozilla',
 'app_name': 'Netscape',
 'appversion': '5.0',
 'name': 'firefox',
 'os': 'linux',
 'oscpu': 'Linux i686 on x86_64',
 'platform': 'Linux i686 on x86_64',
 'user_agent': 'Mozilla/5.0 (X11; Ubuntu; Linux i686 on x86_64; rv:41.0) Gecko/20100101 Firefox/41.0',
 'version': '41.0'}
>>> pprint(generate_navigator_js())
{'appCodeName': 'Mozilla',
 'appName': 'Netscape',
 'appVersion': '38.0',
 'platform': 'MacIntel',
 'userAgent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:38.0) Gecko/20100101 Firefox/38.0'}

Installation

Use pip:

$ pip install -U user_agent

Documentation

Documentation is available at http://user-agent.readthedocs.org

Contribution

Use github to submit bug,fix or wish request: https://github.com/lorien/user_agent/issues

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

user_agent-0.1.5.tar.gz (5.2 kB view details)

Uploaded Source

File details

Details for the file user_agent-0.1.5.tar.gz.

File metadata

  • Download URL: user_agent-0.1.5.tar.gz
  • Upload date:
  • Size: 5.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for user_agent-0.1.5.tar.gz
Algorithm Hash digest
SHA256 c3e93ba28a31faca6c88eaf764a234664dafbce75c1aae35e9a4fa1e234fd74b
MD5 cb77497f86bc4347041fe5475533a47b
BLAKE2b-256 ed24c6182b02eb19fae096cf85c35e7ef74c2ce0a87153381758d3217535d7da

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page