httpagentparser is a Python library (current version 1.9.9) that efficiently extracts operating system, browser, and other relevant information from HTTP User-Agent strings. It offers fast parsing and is primarily focused on detecting OS and browser details rather than being a full-featured agent parser. Releases are infrequent but have recently addressed maintenance and optimization.
pip install httpagentparserVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to use `httpagentparser` to detect operating system and browser information from a user-agent string. It shows both the `simple_detect` method for a concise tuple output and the `detect` method for a more detailed dictionary result, including how to access specific fields like OS name and browser version.
If a predictable order is required (e.g., for logging or consistent output), process the dictionary by sorting its items before representation: `OrderedDict(sorted(httpagentparser.detect(s).items()))` (requires `collections.OrderedDict`).
For highly granular device information, extensive bot detection, or parsing very obscure/malformed user-agent strings, consider alternative libraries like `ua-parser` or commercial services.
Ensure you are using the latest version of `httpagentparser` (1.9.9+) and `pip` and `setuptools` are up-to-date, as recent updates aimed to 'Modernize setup' and 'Remove deprecated setuptools-tox integration.'
Install the library using pip: `pip install httpagentparser`
Upgrade pip and setuptools, then retry the installation: `python -m pip install --upgrade pip setuptools` followed by `pip install httpagentparser`
Upgrade the library to the latest version (`pip install --upgrade httpagentparser`) to get updated detection patterns, or report the specific user-agent string as an issue on the library's GitHub page if the problem persists.
No dependency data recorded yet.