class documentation

class UserAgent:

Known subclasses: werkzeug.useragents._UserAgent

View In Hierarchy

Represents a parsed user agent header value.

The default implementation does no parsing, only the string attribute is set. A subclass may parse the string to set the common attributes or expose other information. Set werkzeug.wrappers.Request.user_agent_class to use a subclass.

New in version 2.0: This replaces the previous useragents module, but does not provide a built-in parser.
Parameters
stringThe header value to parse.
Method __bool__ Undocumented
Method __init__ Undocumented
Method __repr__ Undocumented
Method __str__ Undocumented
Method to​_header Convert to a header value.
Class Variable browser The browser name, if it could be parsed from the string.
Class Variable language The browser language, if it could be parsed from the string.
Class Variable platform The OS name, if it could be parsed from the string.
Class Variable version The browser version, if it could be parsed from the string.
Instance Variable string The original header value.
def __bool__(self):

Undocumented

Returns
boolUndocumented
def __init__(self, string):

Undocumented

Parameters
string:strUndocumented
def __repr__(self):

Undocumented

Returns
strUndocumented
def __str__(self):

Undocumented

Returns
strUndocumented
def to_header(self):
Convert to a header value.
Returns
strUndocumented
browser: t.Optional[str] =
The browser name, if it could be parsed from the string.
language: t.Optional[str] =
The browser language, if it could be parsed from the string.
platform: t.Optional[str] =
The OS name, if it could be parsed from the string.
version: t.Optional[str] =
The browser version, if it could be parsed from the string.
string: str =
The original header value.