Refer to the company Python talent RPC interface Cascade API call
Rpc.api.users.list ()
Rpc.api.login (username= ", password=")
rpc[' Api/users ' (id=222)
Wrote a Demo,python is really concise, less than 30 lines of code to fix
#Coding=utf-8classNamechain (object):def __init__(self,prefix,callback): Self._prefix=prefix self._callback=Callbackdef __getattr__(Self,item): Next_prefix= Self._prefix +'/'+ItemreturnNamechain (next_prefix,self._callback)def __call__(self,**kw): Self._callback (self._prefix,kw)def __getitem__(Self,item): Self._prefix=Itemreturn SelfclassService (object):def __init__(self): Self._api= Namechain ('API', Self._invoke)def_invoke (self,method,params):Print '******************' Print 'Invoke Method:', MethodifLen (params) = =0:Print 'params is empty' return Print 'params is' forKvinchParams.iteritems ():PrintK':', v @propertydefAPI (self):returnSelf._apis=Service () API=S.api#Call mode onePrint 'Call mode one'#api/usersapi.users ()#api/user params {"id", 111, "name": "Leslie"}Api.user (id=111,name='Leslie')#Pai/user/tagsapi.user.tags ()#api/user/tags/list params {"id", 111, "session_id", "Love You Forever"}Api.user.tags.list (id=111,session_id='Love Forever')#Call mode twoPrint 'Call mode two'api['api/users'] () api['api/users'] (id=111,name='Leslie') api['Api/user/tags'] () api['api/user/tags/list'] (id=111,session_id='Love Forever')
Python API URL Cascade build