User Agent Tools
This project provides a Python class UA for working with user agent strings. It offers functionality for generating random user agents, interpreting user agent strings, and extracting information about operating systems, browsers, and platforms.
Features
- Generate random user agents with optional browser and system filters
- Interpret user agent strings to extract OS, browser, and platform information
Installation
pip install user-agent-tools
Usage
from user_agent_tools import UA
# Initialize the UA class
ua_tools = UA()
# Generate a random user agent
random_ua = ua_tools.random()
print(f"Random User Agent: {random_ua}")
# Generate a random user agent for Chrome on Windows
chrome_windows_ua = ua_tools.random(browser="Chrome", system="Windows")
print(f"Random Chrome on Windows User Agent: {chrome_windows_ua}")
# Interpret a user agent string
ua_string = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36"
interpretation = ua_tools.interpret(ua_string)
print(f"Interpretation: {interpretation}")
# Most common user agent
most_common_ua = ua_tools.top_user_agent()
print(f"Most Common User Agent: {most_common_ua}")
# Top-n user agents
top_5_uas = ua_tools.top_n_user_agents(5)
print("Top 5 User Agents:")
for i, ua in enumerate(top_5_uas, 1):
print(f"{i}. {ua}")
License
This project is licensed under the Creative Commons Zero v1.0 Universal (CC0) license.
Acknowledgments
Thanks to willshouse.com, source of the useragents by prevalence listed in data.json.
Metadata
Release files for user-agent-tools 0.1.1
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_tools-0.1.1.tar.gz | 6.1 kB | Without provenance | Details for user_agent_tools-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| user_agent_tools-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for user_agent_tools-0.1.1-py3-none-any.whl |
Total release size: 12.6 kB
Release files / user_agent_tools-0.1.1.tar.gz
| Download URL | user_agent_tools-0.1.1.tar.gz |
|---|---|
| Size | 6.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9178a19d89b96c52ff201f58b4009a6f40bf0c74b8cb97d8307ea1eb1438cc32
|
|
BLAKE2b-256 checksum How to use checksums |
c24d6088d7eea2554d24d84a206f301ea71133309d0621447ff3f20b0b5a1db6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.10.12
|
Release files / user_agent_tools-0.1.1-py3-none-any.whl
| Download URL | user_agent_tools-0.1.1-py3-none-any.whl |
|---|---|
| Size | 6.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e444806b08087ea2e26b126468727a20f9fdd4eede2d71e4f9316f5ef3962fe9
|
|
BLAKE2b-256 checksum How to use checksums |
4caf470db94e9bdd7e46b55ecfdda0ae38b5247b567775d6f91b3a506b375ffe
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.10.12
|
Security for user-agent-tools 0.1.1
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.