shon / httpagentparser

Python HTTP Agent Parser
http://pypi.python.org/pypi/httpagentparser/
MIT License
222 stars 55 forks source link

Return correct version for Android when user agent contains no device name after OS version #83

Closed vpolikarpov closed 5 years ago

vpolikarpov commented 5 years ago

Fixes #82.

shon commented 5 years ago

Hi @Preveter Thanks for this. Do you have the agent string to verify the changes?

vpolikarpov commented 5 years ago

Typically, Chrome on Android appends semicolon and device model after OS version so agent string looks like this:

Mozilla/5.0 (Linux; Android 8.1.0; LG-M700) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Mobile Safari/537.36

Parser fails when there is no device model (so is semicolon):

Mozilla/5.0 (Linux; Android 8.1.0) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/76.0.3809.111 Mobile Safari/537.36

This request fixes it.

shon commented 5 years ago

Thanks @Preveter . New build 1.9.0 is uploaded to pypi.