python3: pass bytes for hmac (#39092)
This commit is contained in:
parent
90c29f0fa0
commit
a8e12b9630
|
@ -26,6 +26,7 @@ import requests
|
|||
from django.conf import settings
|
||||
from django.core.cache import cache
|
||||
from django.http import HttpResponse, HttpResponseBadRequest
|
||||
from django.utils.encoding import smart_bytes
|
||||
from django.utils.http import urlencode, quote
|
||||
from django.utils.six.moves.urllib import parse as urlparse
|
||||
|
||||
|
@ -54,7 +55,7 @@ def sign_query(query, key, algo='sha256', timestamp=None, nonce=None):
|
|||
|
||||
def sign_string(s, key, algo='sha256', timedelta=30):
|
||||
digestmod = getattr(hashlib, algo)
|
||||
hash = hmac.HMAC(str(key), digestmod=digestmod, msg=s)
|
||||
hash = hmac.HMAC(smart_bytes(key), digestmod=digestmod, msg=smart_bytes(s))
|
||||
return hash.digest()
|
||||
|
||||
def get_wcs_services():
|
||||
|
|
Loading…
Reference in New Issue