当前位置: 首页>>代码示例>>Python>>正文


Python ServiceApi.get_resource方法代码示例

本文整理汇总了Python中service_api.ServiceApi.get_resource方法的典型用法代码示例。如果您正苦于以下问题:Python ServiceApi.get_resource方法的具体用法?Python ServiceApi.get_resource怎么用?Python ServiceApi.get_resource使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在service_api.ServiceApi的用法示例。


在下文中一共展示了ServiceApi.get_resource方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: instrument_command

# 需要导入模块: from service_api import ServiceApi [as 别名]
# 或者: from service_api.ServiceApi import get_resource [as 别名]
def instrument_command(device_type, instrument_device_id, agent_command, cap_type=None, session_type=None):
    cap_type = request.args.get('cap_type')
    if request.method in ('POST', 'PUT'):
        if agent_command == 'set_agent':
            resource_params = json.loads(request.data)
            command_response = ServiceApi.set_agent(instrument_device_id, resource_params)
        elif agent_command == 'set_resource':
            resource_params = json.loads(request.data)
            command_response = ServiceApi.set_resource(instrument_device_id, resource_params)
        elif agent_command == 'start':
            command_response = ServiceApi.instrument_agent_start(instrument_device_id)
        elif agent_command == 'stop':
            command_response = ServiceApi.instrument_agent_stop(instrument_device_id)
        else:
            if agent_command == 'RESOURCE_AGENT_EVENT_GO_DIRECT_ACCESS':
                session_type = request.args.get('session_type')
            command_response = ServiceApi.instrument_execute(instrument_device_id, agent_command, cap_type, session_type)
    else:
        if agent_command == 'get_capabilities':
            command_response = ServiceApi.instrument_agent_get_capabilities(instrument_device_id)
        elif agent_command == 'get_resource':
            command_response = ServiceApi.get_resource(instrument_device_id)
        elif agent_command == 'get_platform_agent_state':
            command_response = ServiceApi.platform_agent_state(instrument_device_id, 'get_agent_state')
    return render_json_response(command_response)
开发者ID:Bobfrat,项目名称:ion-ux,代码行数:27,代码来源:main.py

示例2: platform_command

# 需要导入模块: from service_api import ServiceApi [as 别名]
# 或者: from service_api.ServiceApi import get_resource [as 别名]
def platform_command(platform_device_id, agent_command, cap_type=None, agent_instance_id=None):
    app.logger.debug('platform_command %s'%agent_command)
    cap_type = request.args.get('cap_type')
    port_id="n/a"
    if request.method in ('POST', 'PUT'):
        if agent_command == 'set_agent':
            resource_params = json.loads(request.data)
            command_response = ServiceApi.set_agent(platform_device_id, resource_params)
        elif agent_command == 'set_resource':
            resource_params = json.loads(request.data)
            command_response = ServiceApi.set_resource(platform_device_id, resource_params)
        else:
            if ( agent_command == 'RSN_PLATFORM_DRIVER_TURN_ON_PORT' or agent_command == 'RSN_PLATFORM_DRIVER_TURN_OFF_PORT' ):
                port_id = request.args.get('port_id')
            command_response = ServiceApi.platform_execute(platform_device_id, agent_command, cap_type, port_id)
    else:
        if agent_command == 'get_capabilities':
            command_response = ServiceApi.instrument_agent_get_capabilities(platform_device_id)
        elif agent_command == 'get_resource':
            command_response = ServiceApi.get_resource(platform_device_id)
        elif agent_command == 'get_platform_agent_state':
            command_response = ServiceApi.platform_agent_state(platform_device_id, 'get_agent_state')
    return render_json_response(command_response)
开发者ID:mikeh77-TestAccount,项目名称:ion-ux,代码行数:25,代码来源:main.py


注:本文中的service_api.ServiceApi.get_resource方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。