fixed some unicode problems with hashlib, i hope.
This commit is contained in:
parent
a34b8b558e
commit
adc785ade4
|
@ -193,7 +193,7 @@ class _Request(object):
|
||||||
|
|
||||||
for key in keys:
|
for key in keys:
|
||||||
if key != "api_sig" and key != "api_key" and key != "sk":
|
if key != "api_sig" and key != "api_key" and key != "sk":
|
||||||
cache_key += urllib.quote_plus(key) + urllib.quote_plus(urllib.quote_plus(self.params[key]))
|
cache_key += key + self.params[key].encode("utf-8")
|
||||||
|
|
||||||
return hashlib.sha1(cache_key).hexdigest()
|
return hashlib.sha1(cache_key).hexdigest()
|
||||||
|
|
||||||
|
@ -219,7 +219,7 @@ class _Request(object):
|
||||||
|
|
||||||
data = []
|
data = []
|
||||||
for name in self.params.keys():
|
for name in self.params.keys():
|
||||||
data.append('='.join((name, urllib.quote_plus(self.params[name]))))
|
data.append('='.join((name, urllib.quote_plus(self.params[name].encode("utf-8")))))
|
||||||
data = '&'.join(data)
|
data = '&'.join(data)
|
||||||
|
|
||||||
headers = {
|
headers = {
|
||||||
|
@ -2790,7 +2790,7 @@ def md5(text):
|
||||||
"""Returns the md5 hash of a string."""
|
"""Returns the md5 hash of a string."""
|
||||||
|
|
||||||
hash = hashlib.md5()
|
hash = hashlib.md5()
|
||||||
hash.update(text)
|
hash.update(text.encode("utf-8"))
|
||||||
|
|
||||||
return hash.hexdigest()
|
return hash.hexdigest()
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue