Update pbc.py
This commit is contained in:
parent
17044ed686
commit
fa7b4a80b1
1 changed files with 3 additions and 3 deletions
|
@ -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)
|
||||
|
|
Reference in a new issue