示例#1
0
 def look_for_matching_user_agent(self, user_agent):
     if (user_agent.startswith(u"SEC-") or
         user_agent.startswith(u"SAMSUNG-") or
         user_agent.startswith(u"SCH")):
         tolerance = utils.first_slash(user_agent)
     elif (user_agent.startswith(u"Samsung") or
           user_agent.startswith(u"SPH") or
           user_agent.startswith(u"SGH")):
         tolerance = utils.first_space(user_agent)
     elif user_agent.startswith(u"SAMSUNG/"):
         tolerance = utils.second_slash(user_agent)
     elif u"Samsung/SGH-L870" in user_agent:
         tolerance = uiol(user_agent, u"/", 5)
     else:
         tolerance = len(user_agent)
     match = ris_match(self.user_agents, user_agent, tolerance)
     #print "SamsungMatcher %s -> l_f_m_ua -> %s" % (user_agent, match)
     return match
示例#2
0
 def find_matching_ua(self, user_agent):
     tolerance = first_space(user_agent)
     match = self.ris_matcher(user_agent, tolerance)
     return match