Package pywurfl :: Package algorithms :: Package wurfl :: Module normalizers
[hide private]
[frames] | no frames]

Module normalizers

source code

This module contains the supporting classes for the Two Step Analysis user agent algorithm that is used as the primary way to match user agents with the Java API for the WURFL.

A description of the way the following source is intended to work can be found within the source for the original Java API implementation here: http://sourceforge.net/projects/wurfl/files/WURFL Java API/

The original Java code is GPLd and Copyright (c) WURFL-Pro srl


Version: 1.2.1

Author: Armand Lynch <lyncha@users.sourceforge.net>

Copyright: Copyright 2011, Armand Lynch

License: LGPL

Functions [hide private]
 
babelfish(user_agent)
Replace the "via babelfish.yahoo.com" with ''
source code
 
blackberry(user_agent)
Replaces the heading "BlackBerry" string with ''
source code
 
uplink(user_agent)
Replace the trailing UP.Link ...
source code
 
yeswap(user_agent)
Replace the "YesWAP mobile phone proxy" with ''
source code
 
locale_remover(user_agent) source code
 
serial_no(user_agent) source code
 
_combine_funcs(*funcs) source code
 
generic(user_agent) source code
 
prenormalized(normalizer_func) source code
 
_specific_normalizer(user_agent, search_string, vsn_size) source code
 
chrome(user_agent) source code
 
firefox(user_agent) source code
 
konqueror(user_agent) source code
 
msie(user_agent) source code
 
safari(user_agent)
Return the safari user agent stripping out all the characters between U; and Safari/xxx
source code
 
lg(user_agent) source code
 
maemo(user_agent) source code
 
android(user_agent) source code
Variables [hide private]
  __doc__ = ...
  __url__ = 'http://celljam.net/'
  babel_fish_re = re.compile(r'(?u)\s*\(via babelfish.yahoo.com\...
  uplink_re = re.compile(r'(?u)\s*UP\.Link.+$')
  yeswap_re = re.compile(r'(?u)\s*Mozilla/4\.0 \(YesWAP mobile p...
  safari_re = re.compile(r'(?u)(Mozilla/5\.0.*)(;\s*U;.*?)(Safar...
  locale_re = re.compile(r'(?u)(; [a-z]{2}(-[a-zA-Z]{,2})?)')
  serial_number_re = re.compile(r'(?u)(\[(TF|NT|ST)[\d\|X]+\])|(...
  android_re = re.compile(r'(?u)(Android[\s/]\d.\d)(.*?;)')
  konqueror_re = re.compile(r'(?u)(Konqueror/\d)')
  __package__ = 'pywurfl.algorithms.wurfl'
Function Details [hide private]

uplink(user_agent)

source code 

Replace the trailing UP.Link ... with ''

chrome(user_agent)

source code 
Decorators:
  • @prenormalized

firefox(user_agent)

source code 
Decorators:
  • @prenormalized

konqueror(user_agent)

source code 
Decorators:
  • @prenormalized

msie(user_agent)

source code 
Decorators:
  • @prenormalized

safari(user_agent)

source code 

Return the safari user agent stripping out all the characters between U; and Safari/xxx

e.g Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_4_11; fr) AppleWebKit/525.18 (KHTML, like Gecko) Version/3.1.1 Safari/525.18 becomes Mozilla/5.0 (Macintosh Safari/525

Decorators:
  • @prenormalized

lg(user_agent)

source code 
Decorators:
  • @prenormalized

maemo(user_agent)

source code 
Decorators:
  • @prenormalized

android(user_agent)

source code 
Decorators:
  • @prenormalized

Variables Details [hide private]

__doc__

Value:
"""
This module contains the supporting classes for the Two Step Analysis \
user agent
algorithm that is used as the primary way to match user agents with th\
e Java API
for the WURFL.

A description of the way the following source is intended to work can \
...

babel_fish_re

Value:
re.compile(r'(?u)\s*\(via babelfish.yahoo.com\)\s*')

yeswap_re

Value:
re.compile(r'(?u)\s*Mozilla/4\.0 \(YesWAP mobile phone proxy\)')

safari_re

Value:
re.compile(r'(?u)(Mozilla/5\.0.*)(;\s*U;.*?)(Safari/\d{,3})')

serial_number_re

Value:
re.compile(r'(?u)(\[(TF|NT|ST)[\d\|X]+\])|(/SN[\d\|X]+)')