Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Fixed parser to be compatible with new ua-parser #90

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 7, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions 1 .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
sudo: false
language: python
dist: xenial
python:
- "2.7"
- "3.4"
Expand Down
2 changes: 1 addition & 1 deletion 2 setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
zip_safe=False,
include_package_data=True,
package_data={'': ['README.rst']},
install_requires=['ua-parser>=0.4.1'],
install_requires=['ua-parser>=0.8.0'],
classifiers=[
'Development Status :: 5 - Production/Stable',
'Environment :: Web Environment',
Expand Down
15 changes: 8 additions & 7 deletions 15 user_agents/parsers.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
PC_OS_FAMILIES = (
'Windows 95',
'Windows 98',
'Windows ME',
'Solaris',
)

Expand Down Expand Up @@ -51,8 +50,6 @@
'iOS',
'Android',
'Windows Phone',
'Windows Phone OS',
'Windows RT',
'Windows CE',
'Windows Mobile',
'Firefox OS',
Expand Down Expand Up @@ -172,7 +169,7 @@ def is_tablet(self):
return True
if (self.os.family == 'Android' and self._is_android_tablet()):
return True
if self.os.family.startswith('Windows RT'):
if self.os.family == 'Windows' and self.os.version_string.startswith('RT'):
return True
if self.os.family == 'Firefox OS' and 'Mobile' not in self.browser.family:
return True
Expand Down Expand Up @@ -217,16 +214,20 @@ def is_touch_capable(self):
return True
if self.device.family in TOUCH_CAPABLE_DEVICE_FAMILIES:
return True
if self.os.family.startswith('Windows 8') and 'Touch' in self.ua_string:
return True
if self.os.family == 'Windows':
if self.os.version_string.startswith('RT'):
return True
if self.os.version_string.startswith('8') and 'Touch' in self.ua_string:
return True
if 'BlackBerry' in self.os.family and self._is_blackberry_touch_capable_device():
return True
return False

@property
def is_pc(self):
# Returns True for "PC" devices (Windows, Mac and Linux)
if 'Windows NT' in self.ua_string or self.os.family in PC_OS_FAMILIES:
if 'Windows NT' in self.ua_string or self.os.family in PC_OS_FAMILIES or \
self.os.family == 'Windows' and self.os.version_string == 'ME':
return True
# TODO: remove after https://github.com/tobie/ua-parser/issues/127 is closed
if self.os.family == 'Mac OS X' and 'Silk' not in self.ua_string:
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.