def get_http_searches(http_url_req, body, host):
 false_pos = ['i.stack.imgur.com']
 searched = None
 if (http_url_req != None):
  searched = re.search(http_search_re, http_url_req, re.IGNORECASE)
  if (searched == None):
   searched = re.search(http_search_re, body, re.IGNORECASE)
 if ((searched != None) and (host not in false_pos)):
  searched = searched.group(3)
  try:
   searched = searched.decode('utf8')
  except UnicodeDecodeError:
   return
  if (searched in [str(num) for num in range(0, 10)]):
   return
  if (len(searched) > 100):
   return
  msg = ('Searched %s: %s' % (host, unquote(searched.encode('utf8')).replace('+', ' ')))
  return msg

def get_http_searches ( http_url_req , body , host ) : false_pos = [ 'i.stack.imgur.com' ] searched = None if ( http_url_req != None ) : searched = re . search ( http_search_re , http_url_req , re . IGNORECASE ) if ( searched == None ) : searched = re . search ( http_search_re , body , re . IGNORECASE ) if ( ( searched != None ) and ( host not in false_pos ) ) : searched = searched . group ( 3 ) try : searched = searched . decode ( 'utf8' ) except UnicodeDecodeError : return if ( searched in [ str ( num ) for num in range ( 0 , 10 ) ] ) : return if ( len ( searched ) > 100 ) : return msg = ( 'Searched %s: %s' % ( host , unquote ( searched . encode ( 'utf8' ) ) . replace ( '+' , ' ' ) ) ) return msg
find search terms from urls .