boxAgent.py 文件源码

python
阅读 18 收藏 0 点赞 0 评论 0

项目:Mohou_Box-master 作者: mohou 项目源码 文件源码
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.")
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号