阿里云 Headers头加签 报错SignatureDoesNotMatch -问答-阿里云开发者社区-阿里云

开发者社区> 问答> 正文

阿里云 Headers头加签 报错SignatureDoesNotMatch

游客qsjnprxcbwsqs 2021-09-10 18:21:09 217

''' POST http://guiyu-tici.oss-cn-shanghai.aliyuncs.com/tici/1435510519339421696-2-20210910173227426.mp4?uploads HTTP/1.1 Authorization: OSS LTAI5tJJGTagTsH3Wq4S7oj4:RposEDw0sQJSMvZcq/ux7zO02UQ= User-Agent: aliyun-sdk-android/2.9.5(Linux/Android 9/MI%208;PKQ1.180729.001) Host: guiyu-tici.oss-cn-shanghai.aliyuncs.com x-oss-security-token: Date: Fri, 10 Sep 2021 09:32:27 GMT Content-Type: video/mp4 '''

上面是headers头。我自己的加密的,死活就是不对 ''' import hmac import hashlib

accessKeyId="xxxxx", accessKeySecret="FbjXYeZp5rDjI00oQsGJ7hhE0urYvp"

h = hmac.new(oss2.to_bytes(accessKeySecret), oss2.to_bytes("POST\nvideo/mp4\nFri, 10 Sep 2021 09:32:27 GMT\n/guiyu-tici/1435510519339421696-2-20210910173227426.mp4??uploads"), hashlib.sha1) print(h.hexdigest()) signature = oss2.utils.b64encode_as_string(h.digest()) print("Signature: %s" % signature) if signature !='iaA8zLmrVKi3EvtfkMBhuBQ/M54=': print('失败') else: print("成功") '''

求大佬告知错在什么地方。严格按照教程编写的 教程地址:https://help.aliyun.com/document_detail/31951.html

nature报错 match报错 headers报错 osi报错 nat报错
分享到
取消 提交回答
全部回答(0)
开发与运维
使用钉钉扫一扫加入圈子
+ 订阅

集结各类场景实战经验,助你开发运维畅行无忧

相似问题
最新问题
推荐课程