Replace unicode with six.text_type
The unicode() built-in does not exist under Python 3 so use six.text_type, which is set correctly to str or unicode, instead. Change-Id: Ieb29486c99400b4a10ce642cb3adc83f5e4420f6
This commit is contained in:
parent
6b5b2aa356
commit
0c8eaf50a9
@ -20,6 +20,7 @@ import hmac
|
||||
from httplib import HTTPConnection
|
||||
from httplib import HTTPSConnection
|
||||
import json
|
||||
import six
|
||||
import swift
|
||||
from time import gmtime
|
||||
from time import strftime
|
||||
@ -374,9 +375,9 @@ class Swauth(object):
|
||||
password = creds_dict['hash']
|
||||
|
||||
# https://bugs.python.org/issue5285
|
||||
if isinstance(password, unicode):
|
||||
if isinstance(password, six.text_type):
|
||||
password = password.encode('utf-8')
|
||||
if isinstance(msg, unicode):
|
||||
if isinstance(msg, six.text_type):
|
||||
msg = msg.encode('utf-8')
|
||||
|
||||
valid_signature = base64.encodestring(hmac.new(
|
||||
|
Loading…
x
Reference in New Issue
Block a user