diff --git a/welco/utils.py b/welco/utils.py index 22629b0..6f92139 100644 --- a/welco/utils.py +++ b/welco/utils.py @@ -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():