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.")
评论列表
文章目录