Skip to main content

Documentation for user_agent package

Test Status Code Quality Type Check Documentation Status

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(os=('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'}

Command Line Usage

$ ua
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:49.0) Gecko/20100101 Firefox/49.0

$ ua -n chrome -e
{
  "oscpu": "Linux i686 on x86_64", 
  "appName": "Netscape", 
  "appCodeName": "Mozilla", 
  "appVersion": "55.0.2909.25", 
  "platform": "X11; Linux i686 on x86_64", 
  "userAgent": "Mozilla/5.0 (X11; Linux i686 on x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2909.25 Safari/537.36"
}

Installation

Run 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

Metadata

Release files for user-agent 0.1.14

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for user-agent 0.1.14
File Size Uploaded
user_agent-0.1.14.tar.gz 23.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for user-agent 0.1.14
File Interpreter ABI Platform
user_agent-0.1.14-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 43.5 kB

Release files / user_agent-0.1.14.tar.gz

Download URL user_agent-0.1.14.tar.gz
Size 23.4 kB
Tags Source
SHA-256 checksum
How to use checksums
5b25bedb43f89dff7d1ab569a96c16bea6f151a2f07b6323d4356ead5a96e4d2
BLAKE2b-256 checksum
How to use checksums
cebc8b2188a9c54d126b236c8a417e9e1aa05f0a6c74aa62ee5d1d14db57096c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.11.2

Release files / user_agent-0.1.14-py2.py3-none-any.whl

Download URL user_agent-0.1.14-py2.py3-none-any.whl
Size 20.1 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
8eebb14e176e98e674b4ee4403ff880ad78a3fb3a5a9c79a26a21d5af08d56ee
BLAKE2b-256 checksum
How to use checksums
4cfd69b48dad7f7aea651d15e248d50d24f186dc13855834a6aafaafe8846a1f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.11.2

Release history Release notifications | RSS feed

This release

0.1.14 This release

2 release files

0.1.13

1 release file

0.1.12

1 release file

0.1.11

1 release file

0.1.10

1 release file

0.1.9

1 release file

0.1.8

1 release file

0.1.7

1 release file

0.1.6

1 release file

0.1.5

1 release file

0.1.4

1 release file

0.1.3

1 release file

0.1.2

1 release file

0.1.1

1 release file

0.1.0

1 release file

0.0.8

1 release file

0.0.7

1 release file

0.0.6

1 release file

0.0.5

1 release file

0.0.4

1 release file

0.0.3

1 release file

0.0.2

1 release file

0.0.1

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page