diff --git a/generate_temp_url.py b/generate_temp_url.py index f8784f9..17f06de 100644 --- a/generate_temp_url.py +++ b/generate_temp_url.py @@ -36,7 +36,7 @@ def launch(secretkey,set_secretkey,create_temp_url,duration_in_seconds,objectpat path = "/" + storageurl.split("/")[1] + "/" + storageurl.split("/")[2] + "/" + objectpath key = secretkey hmac_body = '%s\n%s\n%s' % (method, expires, path) - sig = hmac.new(key, hmac_body, sha1).hexdigest() + sig = hmac.new(key.encode("utf-8"), hmac_body.encode("utf-8"), sha1).hexdigest() s = 'https://{host}{path}?temp_url_sig={sig}&temp_url_expires={expires}' url = s.format(host=storageurl.split("/")[0], path=path, sig=sig, expires=expires)