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
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)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| user_agent-0.1.14.tar.gz | 23.4 kB | Without provenance | Details for user_agent-0.1.14.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| user_agent-0.1.14-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details for user_agent-0.1.14-py2.py3-none-any.whl |
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
|
Security for user-agent 0.1.14
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.