skillfed

user-agents

A library to identify devices (phones, tablets) and their capabilities by parsing browser user agent strings.

user-agents v2.2.0 11.6M downloads/30d#1,374 on PyPI1,514
Permissive license MIT Abandoned released

What it is and what it does

user-agents is a Python library that wraps ua-parser to parse HTTP user agent strings and classify the requesting device. It identifies whether a user agent belongs to a mobile phone, tablet, or desktop PC; detects touch capabilities; and extracts structured information about the browser family, OS, device brand, and model. The library exposes convenience methods like is_mobile, is_tablet, is_pc, is_touch_capable, and is_bot to make device detection straightforward in web applications.

The package relies entirely on ua-parser to do the actual parsing work and maintains a thin, user-friendly API on top. It has been stable since its 2.0 release in 2019 and is classified as Production/Stable, but development has stalled—the last update was in August 2020, and the repository shows no activity since February 2023. This means the underlying device and browser database will become increasingly outdated as new devices and user agent formats emerge.

Use it for:

  • Serve mobile-optimized content or layouts based on device type detection in web frameworks.
  • Block or flag bot traffic by identifying search engine crawlers and spiders in request logs.
  • Customize user experience by detecting touch-capable devices and enabling touch-friendly interactions.
  • Log and analyze visitor device demographics (mobile vs. tablet vs. desktop) for analytics.
  • Implement device-specific feature flags or API responses in REST or GraphQL backends.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Parses browser user agent strings to identify device type (mobile, tablet, PC), detect touch capabilities, and extract browser and OS information.

Yes, with conditions. Install if you need straightforward user agent parsing for a stable, mature codebase and can tolerate outdated device/browser data. The low install friction, permissive MIT license, and zero known vulnerabilities make it safe to add. However, do not install if you require current detection of recent devices, browsers, or user agent formats—the package is abandoned and will not track new user agents. For new projects, evaluate whether ua-parser alone or a more actively maintained alternative better suits your needs.

Install

user-agents on PyPI

pip

pip install user-agents

uv

uv add user-agents

poetry

poetry add user-agents

Installing user-agents

Before you install

Low install friction with a single runtime dependency (ua-parser). However, the package is abandoned—last release was 2020-08-23 and last commit 2023-02-16—so it will not receive bug fixes or updates for newer user agents or Python versions.

License in practice

MIT license is permissive, allowing commercial and private use with minimal restrictions. You may use, modify, and distribute this package freely as long as you include the original license notice.

Quickstart

pip install user-agents

from user_agents import parse

ua_string = 'Mozilla/5.0 (iPhone; CPU iPhone OS 5_1 like Mac OS X) AppleWebKit/534.46'
user_agent = parse(ua_string)
print(user_agent.is_mobile)  # True
print(user_agent.device.family)  # 'iPhone'

Verify before relying

  • Whether ua-parser's bundled device database is current enough for modern user agents (package has not been updated since 2020).
  • Compatibility with Python versions beyond 3.8 (classifiers only list up to 3.8; no explicit support statement for newer versions).

Package facts

License MIT (permissive)
Python support not specified
Install friction low — pure-Python wheel
Runtime dependencies 1 — ua-parser
Maintenance abandoned — 2,182 days since the last release
Last repo commit
First released
Downloads 11,641,606/month — #1,374 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: user_agents-2.2.0-py3-none-any.whl

Development Status :: 5 - Production/StableEnvironment :: Web EnvironmentIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 2Programming Language :: Python :: 2.7Programming Language :: Python :: 3Programming Language :: Python :: 3.4Programming Language :: Python :: 3.5Programming Language :: Python :: 3.6Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Topic :: Internet :: WWW/HTTPTopic :: Software Development :: Libraries :: Python Modules

Tags

user agent parsingdetect mobile devicebrowser detectiondevice identificationparse user agent stringtablet detectiontouch screen detectiondevice capabilities
user-agent-parsingdevice-detectionabandoned-but-stable

More Python Modules packages

Further reading