boxAgent.py 文件源码

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

项目:Mohou_Box-master 作者: mohou 项目源码 文件源码
def handleUpdate(cmd):
    logging.info("handleUpdate: Start to handle update box. cmd=%s", str(cmd))

    update_version = cmd["version"]
    send_data = {
                 'version'   : update_version,
                }
    headers, body = createFormData(send_data)
    url = client.protocol + client.updateHostPort + "/netupdate_ajax"
    update_request = HTTPRequest(url=url, method="POST", headers=headers, body=body)

    logging.debug("handleUpdate: Send to update box. version=%s", update_version)
    response = yield client.http_client.fetch(update_request)
    if response.error:
        logging.error("handleUpdate: Failed to send to update. error=%s", response.error)
        return
    else:
        logging.debug("handleUpdate: result. response.body=%r", response.body)
        updateRes = json_decode(response.body) 
        if updateRes == 0:
            logging.info("handleUpdate: Succeed to send.")
        else:
            logging.error("handleUpdate: Failed to send. ret_value=%d", updateRes)
        return
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号