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
Werkzeug useragent parsing is off for Motorola One Macro Android phone #1923
Comments
The issue is that Here's the relevant code snippet: platforms: Any = (
(" cros ", "chromeos"),
("iphone|ios", "iphone"),
("ipad", "ipad"),
(r"darwin|mac|os\s*x", "macos"),
("win", "windows"),
(r"android", "android"),
... In your case, |
Rather than doing this in-house, maybe you can consider adding dependency on ua-parser library. I did a review of the project and its based on a pretty popular cross language core that has a very large test set. The python version supports a very wide array of python versions and the code itself should be pretty stable. |
I'll offer up a PR unless you want to take a crack at it. Seems like a good solution. |
I would like to take a crack at it. Thanks! |
Rad! Thanks! |
I'm happy to consider a PR that adjusts the matching rules to fix how this agent is matched, but we won't add a dependency for this. |
The I think it's clear that we can't offer a complete Alternatively, we can add a message in the readme and/or docs to explain that our |
I've opened #1989 to address this platform string but it is far from a complete fix for the rest of the conversation here. |
I noticed this in a flask app but that uses werkzeug to parse useragent info and saw the same behavior in both the flask request object and standalone werkzeug useragent parser.
It looks like the presence of the substring "mac" in "macro" (the device model) is throwing it off. However, I feel like that should be overridden by the clear "Linux" and/or "Android 9".
I would expect the
platform
for this useragent string to be "android".Environment: Linux
The text was updated successfully, but these errors were encountered: