为了账号安全,请及时绑定邮箱和手机立即绑定

腾讯云“人脸静态活体检测”api怎么请求?

腾讯云“人脸静态活体检测”api怎么请求?

###########鉴权代码#######################鉴权签名 appid='' bucket = '' SecretID = '' secret_key = '' expiredTime = time.time()+2592000 currentTime = time.time() rand = round(random.random()*(10**8)) userid = "0" #资源存储的唯一标识,单次签名必填;多次签名选填,如填写则会验证与当前操作的文件路径是否一致。 fileid = 'xuehua.jpg' req = "a=[{appid}]&b=[{bucket}]&k=[{SecretID}]&e=[{expiredTime}]&t=[{currentTime}]&r=[{rand}]&u=[{userid}]&f=[{fileid}]".format(appid=appid,bucket=bucket,SecretID=SecretID,expiredTime=expiredTime,currentTime=currentTime,rand=rand,userid=userid,fileid=fileid) req = bytes(req,'utf8') secret_key = bytes(secret_key,'utf8') sha = hmac.new(secret_key,req,digestmod=hashlib.sha1) encrypts = sha.digest() print(encrypts) sign = base64.b64encode(encrypts) print(sign)结果####################请求静态活体检测api########################url_livedetectpicture = 'http://service.image.myqcloud.com/face/livedetectpicture' header = {'Authorization':sign,"content-type":"application/json"} data = {'appid':appid,"sign":'123456',"url":"http://compuspro-*********.coscd.myqcloud.com/advertising/2017/12/07/bear_three.png"} r = requests.post(url_livedetectpicture,data = data,params=header) print(r.text)结果{"code":3,"message":"invalid request: parsing error - check content-type and body","data":{}}网上资料也不多,希望能请教到大神或有经验的朋友,这个请求该怎么改
查看完整描述

目前暂无任何回答

  • 0 回答
  • 0 关注
  • 2106 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信