@app.route('/preferences', methods=['GET', 'POST'])
def preferences():
 if (request.method == 'POST'):
  resp = make_response(redirect(urljoin(settings['server']['base_url'], url_for('index'))))
  try:
   request.preferences.parse_form(request.form)
  except ValidationException:
   request.errors.append(gettext('Invalid settings, please edit your preferences'))
   return resp
  return request.preferences.save(resp)
 image_proxy = request.preferences.get_value('image_proxy')
 lang = request.preferences.get_value('language')
 disabled_engines = request.preferences.engines.get_disabled()
 allowed_plugins = request.preferences.plugins.get_enabled()
 stats = {}
 for c in categories:
  for e in categories[c]:
   stats[e.name] = {'time': None, 'warn_timeout': False, 'warn_time': False}
   if (e.timeout > settings['outgoing']['request_timeout']):
    stats[e.name]['warn_timeout'] = True
 for engine_stat in get_engines_stats()[0][1]:
  stats[engine_stat.get('name')]['time'] = round(engine_stat.get('avg'), 3)
  if (engine_stat.get('avg') > settings['outgoing']['request_timeout']):
   stats[engine_stat.get('name')]['warn_time'] = True
 return render('preferences.html', locales=settings['locales'], current_locale=get_locale(), image_proxy=image_proxy, engines_by_category=categories, stats=stats, answerers=[{'info': a.self_info(), 'keywords': a.keywords} for a in answerers], disabled_engines=disabled_engines, autocomplete_backends=autocomplete_backends, shortcuts={y: x for (x, y) in engine_shortcuts.items()}, themes=themes, plugins=plugins, allowed_plugins=allowed_plugins, theme=get_current_theme_name(), preferences=True)

@ app . route ( '/preferences' , methods = [ 'GET' , 'POST' ] ) def preferences ( ) : if ( request . method == 'POST' ) : resp = make_response ( redirect ( urljoin ( settings [ 'server' ] [ 'base_url' ] , url_for ( 'index' ) ) ) ) try : request . preferences . parse_form ( request . form ) except ValidationException : request . errors . append ( gettext ( 'Invalid settings, please edit your preferences' ) ) return resp return request . preferences . save ( resp ) image_proxy = request . preferences . get_value ( 'image_proxy' ) lang = request . preferences . get_value ( 'language' ) disabled_engines = request . preferences . engines . get_disabled ( ) allowed_plugins = request . preferences . plugins . get_enabled ( ) stats = { } for c in categories : for e in categories [ c ] : stats [ e . name ] = { 'time' : None , 'warn_timeout' : False , 'warn_time' : False } if ( e . timeout > settings [ 'outgoing' ] [ 'request_timeout' ] ) : stats [ e . name ] [ 'warn_timeout' ] = True for engine_stat in get_engines_stats ( ) [ 0 ] [ 1 ] : stats [ engine_stat . get ( 'name' ) ] [ 'time' ] = round ( engine_stat . get ( 'avg' ) , 3 ) if ( engine_stat . get ( 'avg' ) > settings [ 'outgoing' ] [ 'request_timeout' ] ) : stats [ engine_stat . get ( 'name' ) ] [ 'warn_time' ] = True return render ( 'preferences.html' , locales = settings [ 'locales' ] , current_locale = get_locale ( ) , image_proxy = image_proxy , engines_by_category = categories , stats = stats , answerers = [ { 'info' : a . self_info ( ) , 'keywords' : a . keywords } for a in answerers ] , disabled_engines = disabled_engines , autocomplete_backends = autocomplete_backends , shortcuts = { y : x for ( x , y ) in engine_shortcuts . items ( ) } , themes = themes , plugins = plugins , allowed_plugins = allowed_plugins , theme = get_current_theme_name ( ) , preferences = True )
return preferences information from osquery cli example: .