def handleTest(cmd):
logging.info("handleTest: Start to handle test. cmd=%s", str(cmd))
url = client.protocol + client.localHostPort + "/test"
test_comand = { 'type': cmd['type'],
'data': "",
}
del cmd['type']
test_comand['data'] = json.dumps(cmd)
headers, body = createFormData(test_comand)
operate_request = HTTPRequest(url=url, method="POST", headers=headers, body=body)
response = yield client.http_client.fetch(operate_request, request_timeout=60)
if response.error:
logging.error("handleTest: Failed to send test. error=%s", response.error)
else:
logging.info("handleTest: Test result. response.body=%r", response.body)
res = json_decode(response.body)
if res["ret_value"] != 0:
#need login
logging.warn("handleTest: Failed to execute [%s] test. ret_val=", res["ret_value"])
logging.info("handleTest: End to handle test.")
评论列表
文章目录