Merge "Fix python3.8 hmac compatibility"

This commit is contained in:
Zuul 2019-11-14 03:20:42 +00:00 committed by Gerrit Code Review
commit 8293459a60
1 changed files with 2 additions and 1 deletions

View File

@ -19,6 +19,7 @@ import binascii
import collections
import errno
import functools
import hashlib
import hmac
import math
import os
@ -265,7 +266,7 @@ def _create_random_string(desired_length):
def _calculate_hmac(auth_key, body):
mac = hmac.new(auth_key, body).hexdigest()
mac = hmac.new(auth_key, body, hashlib.md5).hexdigest()
if isinstance(mac, six.text_type):
mac = mac.encode("ascii")
return mac