User Agent Plugin

class chepy_useragent.UserAgent(*data)

This plugin allows Chepy to parse user agent strings

parse_user_agent()

Parse a User-Agent string.

Attempts to identify and categorise information contained in a user-agent string.

Returns:The Chepy object.
Return type:ChepyPlugin

Examples

>>> ua = "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.10; rv:62.0) Gecko/20100101 Firefox/62.0"
>>> Chepy(ua).parse_user_agent().o
{
    "user_agent": {"family": "Firefox", "major": "62", "minor": "0", "patch": None},
    "os": {
        "family": "Mac OS X",
        "major": "10",
        "minor": "10",
        "patch": None,
        "patch_minor": None,
    },
    "device": {"family": "Other", "brand": None, "model": None},
    "string": "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.10; rv:62.0) Gecko/20100101 Firefox/62.0",
}