From 0fee56afd05edacae78d563d7414efcec01d16d1 Mon Sep 17 00:00:00 2001 From: Giovanni Di Grezia Date: Tue, 1 Dec 2015 15:09:59 +0100 Subject: [PATCH] fixed encoding python3 --- generate_temp_url.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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)