boxAgent.py 文件源码

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

项目:Mohou_Box-master 作者: mohou 项目源码 文件源码
def handleProfile(cmd):
    logging.info("handleProfile: Start to handle profile. cmd=%s", str(cmd))
    url = client.protocol + client.localHostPort + "/profile"
    profile_data = { 'printer_profile': cmd['profile'],
                     'token': cmd['token'],
                   }
    headers, body = createFormData(profile_data)
    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("handleProfile: Failed to handle profile. error=%s", response.error)
    else:
        logging.info("handleProfile: handle profile result. response.body=%r", response.body)
        res = json_decode(response.body)
        if res["ret_value"] != 0:
            #need login
            logging.warn("handleProfile: Failed to handle profile. ret_val=%s", res["ret_value"])

    logging.info("handleProfile: End to handle profile.")
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号