1.23. ua_parser

This module provides functionality for parsing browser user agents to extract information from them.

1.23.1. Functions

parse_user_agent(user_agent)[source]

Parse a user agent string and return normalized information regarding the operating system.

Parameters

user_agent (str) – The user agent to parse.

Returns

A parsed user agent, None is returned if the data can not be processed.

Return type

UserAgent

1.23.2. Classes

class UserAgent(os_name, os_version, os_arch)[source]

A parsed representation of the information available from a browsers user agent string. Only the os_name attribute is guaranteed to not be None.

os_name[source]

The OSFamily constant of the name of the operating system.

os_version[source]

The version of the operating system.

os_arch[source]

The OSArch constant of the architecture of the operating system.