httpagentparser
Extracts OS Browser etc information from http user agent string
What it is and what it does
httpagentparser is a lightweight User-Agent string parser that extracts operating system and browser information from HTTP User-Agent headers. It provides two detection modes: a simple function that returns a tuple of OS and browser name/version, and a more detailed function that returns a structured dictionary with separate OS, browser, and distribution information.
The package has no external runtime dependencies and is designed for speed and simplicity rather than comprehensive feature coverage. It supports Python 3.6 and later, has been actively maintained since 2009, and receives regular updates. The library is useful in web applications, analytics systems, and request logging where you need quick identification of client environment without the overhead of a full-featured agent parser.
Use it for:
- Log client OS and browser information in web server request handlers or middleware
- Implement browser-specific feature detection or compatibility warnings in web applications
- Analyze traffic patterns by operating system and browser type in analytics pipelines
- Serve device-appropriate content or styling based on detected OS and browser
- Generate reports on client environment distribution for web application monitoring
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Parses HTTP User-Agent strings to extract and identify the operating system and browser name and version.
Yes. The package is lightweight, actively maintained, has no dependencies, and solves a straightforward parsing task. MIT licensing removes legal friction. Use it when you need quick OS and browser detection from User-Agent strings without the complexity of a full-featured parser. Verify that its detection accuracy meets your application's tolerance before relying on it for critical decisions.
Install
httpagentparser on PyPI
pip
pip install httpagentparseruv
uv add httpagentparserpoetry
poetry add httpagentparserInstalling httpagentparser
Before you install
Low install friction with no runtime dependencies. Actively maintained with a recent release in March 2026 and steady repository activity.
License in practice
Licensed under the MIT License, which permits unrestricted use, modification, and distribution with only attribution and liability disclaimer requirements.
Quickstart
import httpagentparser
s = "Mozilla/5.0 (X11; U; Linux i686; en-US) AppleWebKit/532.9 (KHTML, like Gecko) Chrome/5.0.307.11 Safari/532.9"
print(httpagentparser.simple_detect(s)) # ('Linux', 'Chrome 5.0.307.11')
print(httpagentparser.detect(s)) # {'os': {'name': 'Linux'}, 'browser': {'version': '5.0.307.11', 'name': 'Chrome'}}
Verify before relying
- Whether the parser handles modern User-Agent formats (e.g., the Sec-CH-UA header structure introduced in recent browsers)
- Coverage and accuracy rates for less common operating systems and browsers
- Performance characteristics when parsing high volumes of User-Agent strings
Package facts
| License | The MIT License (MIT) Copyright (c) 2013 Shekhar Tiwatne Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the… (full text in the JSON record) (unclear) |
| Python support | supports the current Python release (>=3.6) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | none |
| Maintenance | actively maintained — 159 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 509,023/month — #6,274 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: httpagentparser-1.9.9-py3-none-any.whl
Tags
More WWW/HTTP packages
urllib3 is an HTTP client library that provides…
permissive · top 100 on PyPI
requestsRequests is a Python HTTP library that…
permissive · top 100 on PyPI
h11h11 is a pure-Python HTTP/1.1 protocol…
permissive · top 100 on PyPI
httpxHTTPX is a fully featured HTTP client library…
permissive · top 100 on PyPI
httpcoreA minimal low-level HTTP client library that…
permissive · top 100 on PyPI
aiohttpaiohttp is an async HTTP client and server…
permissive · top 100 on PyPI
ua-parserParses user-agent strings to extract browser,…
permissive · top 1,000 on PyPI
device-detectorParses user agent strings and client hints to…
unclear · top 15,000 on PyPI
crawlerdetectIdentifies bots, crawlers, and spiders by…
permissive · top 15,000 on PyPI
latest-user-agentsFetches and provides current user agent strings…
permissive · top 15,000 on PyPI
wootheeWoothee parses user-agent strings to identify…
permissive · top 15,000 on PyPI
fake-useragentGenerates random or browser-specific user-agent…
permissive · top 5,000 on PyPI
fake-headersGenerates realistic User-Agent strings and HTTP…
permissive · top 15,000 on PyPI
user-agentsParses browser user agent strings to identify…
permissive · top 5,000 on PyPI
django-user-agentsParses HTTP User-Agent headers in Django to…
permissive · top 15,000 on PyPI
ua-parser-rsProvides a Rust-accelerated user-agent parser…
permissive · top 5,000 on PyPI