def async_call(http_server_ip, apicmd, session_uuid): api_instance = api.Api(host=http_server_ip, port='8080') api_instance.set_session_to_api_message(apicmd, session_uuid) (name, event) = api_instance.async_call_wait_for_complete(apicmd) if not event.success: raise api.ApiError("Async call at %s: [%s] meets error: %s." % (http_server_ip, apicmd.__class__.__name__, api.error_code_to_string(reply.error))) print("[Async call at %s]: [%s] Success" % (http_server_ip, apicmd.__class__.__name__)) return event
def sync_call(http_server_ip, apicmd, session_uuid): api_instance = api.Api(host=http_server_ip, port='8080') if session_uuid: api_instance.set_session_to_api_message(apicmd, session_uuid) (name, reply) = api_instance.sync_call(apicmd) if not reply.success: raise api.ApiError("Sync call at %s: [%s] meets error: %s." % (http_server_ip, apicmd.__class__.__name__, api.error_code_to_string(reply.error))) print("[Sync call at %s]: [%s] Success" % (http_server_ip, apicmd.__class__.__name__)) return reply