Library to build content for User-Agent HTTP header
Project description
Documentation for user_agent package
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.navigatorJavaScript 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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file user_agent-0.1.14.tar.gz.
File metadata
- Download URL: user_agent-0.1.14.tar.gz
- Upload date:
- Size: 23.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.11.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5b25bedb43f89dff7d1ab569a96c16bea6f151a2f07b6323d4356ead5a96e4d2
|
|
| MD5 |
eff8aa535337b928cdbac7a8fe0e26de
|
|
| BLAKE2b-256 |
cebc8b2188a9c54d126b236c8a417e9e1aa05f0a6c74aa62ee5d1d14db57096c
|
File details
Details for the file user_agent-0.1.14-py2.py3-none-any.whl.
File metadata
- Download URL: user_agent-0.1.14-py2.py3-none-any.whl
- Upload date:
- Size: 20.1 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.11.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8eebb14e176e98e674b4ee4403ff880ad78a3fb3a5a9c79a26a21d5af08d56ee
|
|
| MD5 |
802684a933da276f4f9a1460f61687dd
|
|
| BLAKE2b-256 |
4cfd69b48dad7f7aea651d15e248d50d24f186dc13855834a6aafaafe8846a1f
|