From 20b9bdedd2895de18945519b5e9348a2fade692a Mon Sep 17 00:00:00 2001 From: hugovk Date: Wed, 12 Mar 2014 13:43:41 +0200 Subject: [PATCH] Python 3 fix: Unicode-objects must be encoded before hashing --- pylast.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pylast.py b/pylast.py index 051007c..03c7767 100644 --- a/pylast.py +++ b/pylast.py @@ -1059,7 +1059,7 @@ class _Request(object): if key != "api_sig" and key != "api_key" and key != "sk": cache_key += key + _string(self.params[key]) - return hashlib.sha1(cache_key).hexdigest() + return hashlib.sha1(cache_key.encode("utf-8")).hexdigest() def _get_cached_response(self): """Returns a file object of the cached response."""