shon / httpagentparser

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

Blackberry not recognized #13

Open oliver opened 12 years ago

oliver commented 12 years ago

It would be neat if httpagentparser would detect BlackBerry browsers.

In some server logs I found the following UA strings containing BlackBerry:

"BlackBerry8310/4.5.0.174 Profile/MIDP-2.0 Configuration/CLDC-1.1 VendorID/124" "BlackBerry8310/4.5.0.69 Profile/MIDP-2.0 Configuration/CLDC-1.1 VendorID/114" "BlackBerry8520/4.6.1.314 Profile/MIDP-2.0 Configuration/CLDC-1.1 VendorID/124" "BlackBerry8900/4.6.1.310 Profile/MIDP-2.0 Configuration/CLDC-1.1 VendorID/114" "BlackBerry8900/5.0.0.1036 Profile/MIDP-2.1 Configuration/CLDC-1.1 VendorID/124" "BlackBerry8900/5.0.0.681 Profile/MIDP-2.1 Configuration/CLDC-1.1 VendorID/124" "BlackBerry9000/4.6.0.303 Profile/MIDP-2.0 Configuration/CLDC-1.1 VendorID/114" "BlackBerry9000/5.0.0.1036 Profile/MIDP-2.1 Configuration/CLDC-1.1 VendorID/124" "BlackBerry9300/5.0.0.794 Profile/MIDP-2.1 Configuration/CLDC-1.1 VendorID/114" "BlackBerry9500/4.7.0.78 Profile/MIDP-2.0 Configuration/CLDC-1.1 VendorID/124" "BlackBerry9500/5.0.0.841 Profile/MIDP-2.1 Configuration/CLDC-1.1 VendorID/124" "BlackBerry9520/5.0.0.1077 Profile/MIDP-2.1 Configuration/CLDC-1.1 VendorID/124" "BlackBerry9700/5.0.0.344 Profile/MIDP-2.1 Configuration/CLDC-1.1 VendorID/124" "BlackBerry9700/5.0.0.442 Profile/MIDP-2.1 Configuration/CLDC-1.1 VendorID/612" "BlackBerry9700/5.0.0.593 Profile/MIDP-2.1 Configuration/CLDC-1.1 VendorID/114" "BlackBerry9700/5.0.0.593 Profile/MIDP-2.1 Configuration/CLDC-1.1 VendorID/114 Webwasher/6.8.7" "BlackBerry9700/5.0.0.593 Profile/MIDP-2.1 Configuration/CLDC-1.1 VendorID/604" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0) BlackBerry8700/4.1.0 Profile/MIDP-2.0 Configuration/CLDC-1.1 VendorID/100" "Mozilla/5.0 (BlackBerry; U; BlackBerry 9700; de) AppleWebKit/534.8+ (KHTML, like Gecko) Version/6.0.0.448 Mobile Safari/534.8+" "Mozilla/5.0 (BlackBerry; U; BlackBerry 9700; de) AppleWebKit/534.8+ (KHTML, like Gecko) Version/6.0.0.668 Mobile Safari/534.8+" "Mozilla/5.0 (BlackBerry; U; BlackBerry 9700; es) AppleWebKit/534.8+ (KHTML, like Gecko) Version/6.0.0.344 Mobile Safari/534.8+" "Mozilla/5.0 (BlackBerry; U; BlackBerry 9780; de) AppleWebKit/534.8+ (KHTML, like Gecko) Version/6.0.0.546 Mobile Safari/534.8+" "Mozilla/5.0 (BlackBerry; U; BlackBerry 9800; de) AppleWebKit/534.1+ (KHTML, like Gecko) Version/6.0.0.246 Mobile Safari/534.1+" "Mozilla/5.0 (BlackBerry; U; BlackBerry 9800; de) AppleWebKit/534.1+ (KHTML, like Gecko) Version/6.0.0.337 Mobile Safari/534.1+"

shon commented 12 years ago

Hi Oliver, if you could tell me what is expected return when we some of these agent strings to detect function I would soon add support.

oliver commented 12 years ago

Based on http://supportforums.blackberry.com/t5/Web-and-WebWorks-Development/How-to-detect-the-BlackBerry-Browser/ta-p/559862 and http://www.useragentstring.com/BlackBerry_id_17117.php maybe the results for the UA strings posted above could be like this:

I think "dist" and "flavor" can be left empty for these UAs.

What do you think?

srs81 commented 12 years ago

I just submitted a pull request which I think addresses this. It does not get the version, but it detects Blackberry phones and tablet (Playbook) correctly.

shon commented 12 years ago

Thanks srs81. Do you think flavor "Playbook" is more appropriate? Specifically the last test. Further the string mentions "RIM Tablet OS 1.0.0".

srs81 commented 12 years ago

Hi, sure. The only problem with that is: in my specific tests, I often have a "higher level" categorization based on OS, and a lower level one based on the specfic type. That's why for Android, I have added the tablet and phone-specific checks. Is there a way to designate the Playbook as a "Playbook" distribution for the "Blackberry" OS?

srs81 commented 12 years ago

Hello, I believe this is fixed, and can be closed, yes? :)

shon commented 12 years ago

It does detect OS but does not detect version yet. Further it fails for "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0) BlackBerry8700/4.1.0 Profile/MIDP-2.0 Configuration/CLDC-1.1 VendorID/100". Although this perhaps is a corner case. So I think we should leave it open till above issues are addressed.