本文整理汇总了Python中proxy.Proxy.callRemote方法的典型用法代码示例。如果您正苦于以下问题:Python Proxy.callRemote方法的具体用法?Python Proxy.callRemote怎么用?Python Proxy.callRemote使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类proxy.Proxy
的用法示例。
在下文中一共展示了Proxy.callRemote方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: remote_radmin_proxy
# 需要导入模块: from proxy import Proxy [as 别名]
# 或者: from proxy.Proxy import callRemote [as 别名]
def remote_radmin_proxy(self,service_uuid, command, params):
if self.services.has_option(service_uuid, 'radmin_pw'):
host = self.services.get(service_uuid, 'radmin_host')
params['password'] = self.services.get(service_uuid, 'radmin_pw')
else: defer.returnValue('nocredentials')
#modify the Regions.ini. We could do this later properly in RemoteController.cs
if command == 'admin_create_region' or command == 'admin_restart' or command== 'admin_shutdown':
if params.has_key('region_id'):
params['regionID'] = params['region_id']
params['listen_ip'] = '0.0.0.0'
params['listen_port'] = self.get_free_port()
params['external_address'] = self.config.get('client','wan_ip')
testresponse = self.update_region_ini(service_uuid, params,'add')
elif command == 'admin_delete_region':
self.update_region_ini(service_uuid, params,'del')
proxy = Proxy(host)
try:
response = yield proxy.callRemote(command, params)
if 'success' in response:
if response['success']:
defer.returnValue(response)
if 'error' in response:
response = {'status': {'code':'RADMIN_FAILED','feedback':response['error']}}
if command == 'admin_create_region':
self.update_region_ini(service_uuid, params,'del')
except Error:
if command == 'admin_create_region':
self.update_region_ini(service_uuid, params,'del')
response = {'status': {'code':'RADMIN_FAILED'}}
defer.returnValue(response)