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

Commit 87936f2

Browse filesBrowse files
IMDaggerselwin
authored andcommitted
Fixed parser to be compatible with new ua-parser (selwin#90)
* fixed tests to be compatible with new ua-parser * enable xenial flag to work with py3.7
1 parent a005ce8 commit 87936f2
Copy full SHA for 87936f2

File tree

Expand file treeCollapse file tree

3 files changed

+10
-8
lines changed
Filter options
Expand file treeCollapse file tree

3 files changed

+10
-8
lines changed

‎.travis.yml

Copy file name to clipboardExpand all lines: .travis.yml
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
sudo: false
22
language: python
3+
dist: xenial
34
python:
45
- "2.7"
56
- "3.4"

‎setup.py

Copy file name to clipboardExpand all lines: setup.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
zip_safe=False,
1515
include_package_data=True,
1616
package_data={'': ['README.rst']},
17-
install_requires=['ua-parser>=0.4.1'],
17+
install_requires=['ua-parser>=0.8.0'],
1818
classifiers=[
1919
'Development Status :: 5 - Production/Stable',
2020
'Environment :: Web Environment',

‎user_agents/parsers.py

Copy file name to clipboardExpand all lines: user_agents/parsers.py
+8-7Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
PC_OS_FAMILIES = (
1717
'Windows 95',
1818
'Windows 98',
19-
'Windows ME',
2019
'Solaris',
2120
)
2221

@@ -51,8 +50,6 @@
5150
'iOS',
5251
'Android',
5352
'Windows Phone',
54-
'Windows Phone OS',
55-
'Windows RT',
5653
'Windows CE',
5754
'Windows Mobile',
5855
'Firefox OS',
@@ -172,7 +169,7 @@ def is_tablet(self):
172169
return True
173170
if (self.os.family == 'Android' and self._is_android_tablet()):
174171
return True
175-
if self.os.family.startswith('Windows RT'):
172+
if self.os.family == 'Windows' and self.os.version_string.startswith('RT'):
176173
return True
177174
if self.os.family == 'Firefox OS' and 'Mobile' not in self.browser.family:
178175
return True
@@ -217,16 +214,20 @@ def is_touch_capable(self):
217214
return True
218215
if self.device.family in TOUCH_CAPABLE_DEVICE_FAMILIES:
219216
return True
220-
if self.os.family.startswith('Windows 8') and 'Touch' in self.ua_string:
221-
return True
217+
if self.os.family == 'Windows':
218+
if self.os.version_string.startswith('RT'):
219+
return True
220+
if self.os.version_string.startswith('8') and 'Touch' in self.ua_string:
221+
return True
222222
if 'BlackBerry' in self.os.family and self._is_blackberry_touch_capable_device():
223223
return True
224224
return False
225225

226226
@property
227227
def is_pc(self):
228228
# Returns True for "PC" devices (Windows, Mac and Linux)
229-
if 'Windows NT' in self.ua_string or self.os.family in PC_OS_FAMILIES:
229+
if 'Windows NT' in self.ua_string or self.os.family in PC_OS_FAMILIES or \
230+
self.os.family == 'Windows' and self.os.version_string == 'ME':
230231
return True
231232
# TODO: remove after https://github.com/tobie/ua-parser/issues/127 is closed
232233
if self.os.family == 'Mac OS X' and 'Silk' not in self.ua_string:

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.