ua-parser
Python port of Browserscope's user agent parser
Decision gist · record as of 2026-08-14
Yes. The package is actively maintained, has no known vulnerabilities, installs with low friction, and solves a common web development problem with a straightforward API. The Apache-2.0 license is permissive. Install with the [regex] extra unless memory is severely constrained.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python 3.10 or newer; the [regex] extra is strongly recommended for performance.
- Low friction installation with a single runtime dependency.
- Actively maintained as of 2026-05-27, with recent releases and a stable codebase.
License · maintenance · safety
Apache-2.0 (permissive) — Licensed under Apache-2.0 (permissive), allowing use in commercial and proprietary projects with minimal restrictions.
last release 2026-04-05 (131 days) · last repo commit 2026-05-27 · 648 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 27,440,250 downloads/mo, #860 on PyPI
Alternatives
Verify before relying
pip install 'ua-parser[regex]'
from ua_parser import parse
ua_string = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.104 Safari/537.36'
result = parse(ua_string)
print(result.user_agent.family, result.os.family, result.device.family)- Performance characteristics of the regex feature variant versus pure Python implementation on different runtimes
- Accuracy and coverage of the underlying user-agent pattern database
What it is and what it does
ua-parser is the official Python implementation of the User Agent String Parser project. It takes raw user-agent header strings and breaks them down into structured components: browser family and version, operating system and version, and device type and brand. The package exposes a main parse() function that returns all three categories at once, plus separate functions to extract just browser, OS, or device data.
The library supports CPython 3.10 and newer, recent PyPy supporting 3.10, and GraalPy 25. It depends on ua-parser-builtins for its pattern data and offers two parsing backends: a regex-based resolver (recommended for speed) and a pure Python fallback (more memory-efficient but slower, especially on non-CPython runtimes). When a user-agent string cannot be parsed, the library returns None for the unmatched fields rather than raising an error.
Use it for
- Log analysis: identify which browsers and devices are accessing your web application
- Analytics: segment traffic by browser family, OS version, or device type for reporting
- Content negotiation: serve different content or features based on detected browser capabilities
- Bot detection: distinguish between real user agents and automated crawlers
- A/B testing: target experiments to specific browser or OS combinations
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
The package is actively maintained, has no known vulnerabilities, installs with low friction, and solves a common web development problem with a straightforward API. The Apache-2.0 license is permissive. Install with the [regex] extra unless memory is severely constrained.
Install
ua-parser on PyPI
Before you install
Low friction installation with a single runtime dependency. Actively maintained as of 2026-05-27, with recent releases and a stable codebase.
Requires Python 3.10 or newer; the [regex] extra is strongly recommended for performance.
License in practice
Licensed under Apache-2.0 (permissive), allowing use in commercial and proprietary projects with minimal restrictions.
Quickstart
pip install 'ua-parser[regex]'
from ua_parser import parse
ua_string = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.104 Safari/537.36'
result = parse(ua_string)
print(result.user_agent.family, result.os.family, result.device.family)
Verify before relying
- Performance characteristics of the regex feature variant versus pure Python implementation on different runtimes
- Accuracy and coverage of the underlying user-agent pattern database
Package facts
| License | Apache-2.0 permissive |
| Python support | Supports the current Python release >=3.10 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 1 packageua-parser-builtins |
| Maintenance | Actively maintained 131 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 27,440,250 / month, #860 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 5 - Production/StableEnvironment :: Web EnvironmentIntended Audience :: DevelopersOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: GraalPyProgramming Language :: Python :: Implementation :: PyPyTopic :: Internet :: WWW/HTTPTopic :: Software Development :: Libraries :: Python Modules |
Evidence: ua_parser-1.0.2-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “parse user agent string”
- ua-parserParses user-agent strings to extract browser, operating system, and…
- httpagentparserParses HTTP User-Agent strings to extract and identify the operating…
- user-agentsParses browser user agent strings to identify device type (mobile,…
Give your agent the search over MCP, or paste the wish link into any chat.
More Python Modules packages
Converts domain names between Unicode and ASCII-compatible encoding (Punycode) according to IDNA 2008 and Unicode Technical Standard 46, with security validation and broader script coverage than the standard library.
Install it if you work with internationalized domain names, need to validate domains, or use HTTP clients that depend on it transitively.
Setuptools is a Python build backend and package management tool that handles building, distributing, and installing Python packages, including support for C/C++ extension modules.
PyYAML parses and emits YAML 1.1 data format, enabling serialization and deserialization of configuration files and Python objects to and from human-readable YAML text.
Pydantic validates Python data structures against type hints, coercing and checking input at runtime to ensure it matches a declared schema.
Provides reusable metadata objects for use with PEP-593 `typing.Annotated` to express common constraints like bounds, collection sizes, and predicates on types.
Install it if you use or build libraries that need to express type constraints in a standardized, inspectable way—or if you want to annotate your own types with…
Provides runtime tools to inspect and introspect Python type annotations, enabling programmatic examination of type hints at execution time.
See also httpagentparser · ua-parser-rs · user-agents · device-detector · ua-generator · ua-parser-builtins · latest-user-agents · crawlerdetect · fake-headers · robotspy