Closed ardaguclu closed 4 years ago
Just noting that this happens for any integer version. E.g.:
In [1]: from user_agents import parse
In [2]: parse("Dalvik/2.1.0 (Linux; U; Android 9; SM-G965U Build/PPR1.180610.011)").os.version_string
Out[2]: ''
In [3]: parse("Dalvik/2.1.0 (Linux; U; Android 9.0; SM-G965U Build/PPR1.180610.011)").os.version_string
Out[3]: '9'
I haven't had time to look into the package to see if this is a bug or the intended implementation, but I wanted to tack on why it's happening.
I have the same problem there is a go package "github.com/mssola/useragent" can get "9.0" but our project use python who can slove it ~~
The issue actually seems to be with https://github.com/ua-parser/uap-python, which this library uses under the hood.
from ua_parser import user_agent_parser
user_agent_parser.Parse("Dalvik/2.1.0 (Linux; U; Android 9; SM-G965U Build/PPR1.180610.011)")['os']
{'family': 'Android', 'major': None, 'minor': None, 'patch': None, 'patch_minor': None}
Edit:
Also, ua-parser/uap-parser
on PyPI was released in April 2018 (ver 0.8.0), whereas the Github repo shows lots of commits after that. Installing ua-parser/uap-parser
from master
seems to work for integer versions. But yeah, it's a bit scary to install straight from master, rather than a known good release.
Hello,
When I parse the below user agent, it returns empty. Although it should return 9.
Dalvik/2.1.0 (Linux; U; Android 9; SM-G965U Build/PPR1.180610.011)