###########鑒權(quán)代碼#######################鑒權(quán)簽名
appid=''
bucket?=?''
SecretID?=?''
secret_key?=?''
expiredTime?=?time.time()+2592000
currentTime?=?time.time()
rand?=?round(random.random()*(10**8))
userid?=?"0"
#資源存儲的唯一標(biāo)識,單次簽名必填;多次簽名選填,如填寫則會驗證與當(dāng)前操作的文件路徑是否一致。
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)結(jié)果####################請求靜態(tài)活體檢測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)結(jié)果{"code":3,"message":"invalid?request:?parsing?error?-?check?content-type?and?body","data":{}}網(wǎng)上資料也不多,希望能請教到大神或有經(jīng)驗的朋友,這個請求該怎么改
騰訊云“人臉靜態(tài)活體檢測”api怎么請求?
無無法師
2018-03-25 17:37:20