#NEWLINE# def run( req ) : #NEWLINE# #INDENT# stackhut . req_id = req [ 'req_id' ] #NEWLINE# ( iface_name , func_name ) = req [ 'method' ] . split ( '.' ) #NEWLINE# params = req [ 'params' ] #NEWLINE# if ( iface_name in SERVICES ) : #NEWLINE# #INDENT# iface_impl = SERVICES [ iface_name ] #NEWLINE# try : #NEWLINE# #INDENT# func = getattr ( iface_impl , func_name ) #NEWLINE# #UNINDENT# except AttributeError : #NEWLINE# #INDENT# return gen_error ( ( - 32601 ) ) #NEWLINE# #UNINDENT# try : #NEWLINE# #INDENT# result = ( func ( * params ) if params else func ( ) ) #NEWLINE# #UNINDENT# except stackhut . ServiceError as e : #NEWLINE# #INDENT# return gen_error ( ( - 32002 ) , e . msg , e . data ) #NEWLINE# #UNINDENT# return dict ( result = result ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# return gen_error ( ( - 32601 ) )