def execute_cmd(cmd, from_async=False):
 for hook in frappe.get_hooks(u'override_whitelisted_methods', {}).get(cmd, []):
  cmd = hook
  break
 try:
  method = get_attr(cmd)
 except:
  frappe.respond_as_web_page(title=u'Invalid Method', html=u'Method not found', indicator_color=u'red', http_status_code=404)
  return
 if from_async:
  method = method.queue
 is_whitelisted(method)
 ret = frappe.call(method, **frappe.form_dict)
 if ret:
  frappe.response[u'message'] = ret

def execute_cmd ( cmd , from_async = False ) : for hook in frappe . get_hooks ( u'override_whitelisted_methods' , { } ) . get ( cmd , [ ] ) : cmd = hook break try : method = get_attr ( cmd ) except : frappe . respond_as_web_page ( title = u'Invalid Method' , html = u'Method not found' , indicator_color = u'red' , http_status_code = 404 ) return if from_async : method = method . queue is_whitelisted ( method ) ret = frappe . call ( method , ** frappe . form_dict ) if ret : frappe . response [ u'message' ] = ret
execute a request as python module .