fixed encoding python3

This commit is contained in:
2015-12-01 15:09:59 +01:00
parent c87da373cd
commit 0fee56afd0

View File

@@ -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)