sig_string="GETyunsou.api.qcloud.com/v2/index.php?Action={{action}}&Nonce={{none}}&Region={{region}}&SecretId={{secretId}}&Timestamp={{timeStamp}}&instanceIds.0={{instanceId}}&limit=20&offset=0".format(action=action,nonce=nonce,region=region,secretId=secretId,timeStamp=timeStamp,instanceId=instanceId) sig=sig_string.encode(encoding="utf-8") import hashlib m= hashlib.sha1() m.update(sig) import base64 result_sig=base64.b64encode(m.digest()) #获取鉴权 data_ready["Signature"]=result_sig print(result_sig)
b'SwcPpReUwFZU1cgsiaYl54OGc7Y='
鉴权去
r=requests.post("https://yunsou.api.qcloud.com/v2/index.php",params={"Action":action},data=data_ready) print(r.url) print(r.content["message"].decode())
b'{"code":4100,"message":"\\u9274\\u6743\\u5931\\u8d25\\uff0c\\u8bf7\\u53c2\\u8003\\u6587\\u6863\\u4e2d\\u9274\\u6743\\u90e8\\u5206\\u3002","codeDesc":"AuthFailure"}'
完整图片长这样
pardon110