def api_handler(kwargs):
 mode = kwargs.get('mode', '')
 output = kwargs.get('output')
 name = kwargs.get('name', '')
 callback = kwargs.get('callback', '')
 cherrypy.response.timeout = (60 * 10)
 if isinstance(mode, list):
  mode = mode[0]
 if isinstance(output, list):
  output = output[0]
 response = _api_table.get(mode, (_api_undefined, 2))[0](name, output, kwargs)
 if ((output == 'json') and callback):
  response = ('%s(%s)' % (callback, response))
 return response

def api_handler ( kwargs ) : mode = kwargs . get ( 'mode' , '' ) output = kwargs . get ( 'output' ) name = kwargs . get ( 'name' , '' ) callback = kwargs . get ( 'callback' , '' ) cherrypy . response . timeout = ( 60 * 10 ) if isinstance ( mode , list ) : mode = mode [ 0 ] if isinstance ( output , list ) : output = output [ 0 ] response = _api_table . get ( mode , ( _api_undefined , 2 ) ) [ 0 ] ( name , output , kwargs ) if ( ( output == 'json' ) and callback ) : response = ( '%s(%s)' % ( callback , response ) ) return response
api dispatcher .