You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

user-agent-parser

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

user-agent-parser

Python 3 library to parse User-Agent strings and detect browser, OS and device details

0.1.6
pipPyPI
Maintainers
1

PyPI Downloads Python Versions License Codecov CI Wheel Implementation Code style: black Linter: ruff Docs Open Issues

⭐ If you find this project useful, please star it on GitHub!

Python User Agent Parser

user_agent_parser is a Python 3 library that provides an easy way to identify/detect devices from user agent string

  • User agent is a mobile or computer
  • User agent Browser name and versions
  • User agent Device name

user_agent_parser hosted on PyPI and can be installed as such:

pip install install user-agent-parser

Alternatively, you can also get the latest source code from Github and install it manually.

from user_agent_parser import Parser
iphone_ua_str = "Mozilla/5.0 (iPhone; CPU iPhone OS 13_6 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) CriOS/92.0.4515.90 Mobile/15E148 Safari/604.1"
parser = Parser(iphone_ua_str)

 # Calling parser
 browser, browser_version, os, os_version, device_type, device_name, device_host = parser()
 # or you can call directly properties
 parser.device_name

Running Tests

python -m unittest discover

Changelog

Version 0.1.1

  • Doc added

Version 0.1

  • Initial release

Keywords

user agent

FAQs

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts