Archived
1
0
Fork 0

Update pbc.py

This commit is contained in:
yzhh 2020-08-27 21:19:40 +08:00
parent 17044ed686
commit fa7b4a80b1

View file

@ -11,7 +11,7 @@ from config import config
def hash_hmac(key, code, sha1):
hmac_code = hmac.new(key.encode(), code.encode(), hashlib.sha1())
hmac_code = hmac.new(key.encode(), code.encode(), hashlib.sha1)
return base64.b64encode(hmac_code.digest()).decode('utf-8')
@ -74,7 +74,7 @@ async def pbc1(newUsers):
contentMd5=contentMd5,
date=headers['Date'], step1=step1, step2=step2)
print(step3)
sign = "acs {}:{}".format(accessKeyId, hash_hmac(accessKeySecret, step3, hashlib.sha1()))
sign = "acs {}:{}".format(accessKeyId, hash_hmac(accessKeySecret, step3, hashlib.sha1))
headers['Authorization'] = sign
print(headers)
# 'Authorization': "acs {}:{}".format(accessKeyId, sign)
@ -147,7 +147,7 @@ async def pbc2(newUsers):
contentMd5=contentMd5,
date=headers['Date'], step1=step1, step2=step2)
print(step3)
sign = "acs {}:{}".format(accessKeyId, hash_hmac(accessKeySecret, step3, hashlib.sha1()))
sign = "acs {}:{}".format(accessKeyId, hash_hmac(accessKeySecret, step3, hashlib.sha1))
headers['Authorization'] = sign
print(headers)
# 'Authorization': "acs {}:{}".format(accessKeyId, sign)