Skip to content

Commit

Permalink
Using OS family instead of parsing the UA string
Browse files Browse the repository at this point in the history
  • Loading branch information
kulor committed Jan 27, 2017
1 parent 5977783 commit 7121f98
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
10 changes: 9 additions & 1 deletion user_agents/devices.json
Expand Up @@ -348,6 +348,14 @@
"is_touch_capable": false,
"ua_string": "Mozilla/5.0 (X11; U; SunOS sun4u; en-US; rv:1.6) Gecko/20040503",
"str": "Other / Solaris / Other"
},
"chrome_os": {
"is_bot": false,
"is_mobile": false,
"is_pc": true,
"is_tablet": false,
"is_touch_capable": false,
"ua_string": "Mozilla/5.0 (X11; CrOS i686 0.12.433) AppleWebKit/534.30 (KHTML, like Gecko) Chrome/12.0.742.77 Safari/534.30",
"str": "CrOS"
}
}

2 changes: 1 addition & 1 deletion user_agents/parsers.py
Expand Up @@ -234,7 +234,7 @@ def is_pc(self):
# Maemo has 'Linux' and 'X11' in UA, but it is not for PC
if 'Maemo' in self.ua_string:
return False
if 'CrOS' in self.ua_string:
if 'Chrome OS' in self.os.family:
return True
if 'Linux' in self.ua_string and 'X11' in self.ua_string:
return True
Expand Down

0 comments on commit 7121f98

Please sign in to comment.