Fix method name: this always returns unicode keys and values

This commit is contained in:
Konstantin Lopuhin 2016-02-18 10:10:16 +03:00
parent 49313a6988
commit 617631f264
2 changed files with 5 additions and 2 deletions

View File

@ -82,7 +82,7 @@ class S3DownloadHandler(object):
awsrequest = botocore.awsrequest.AWSRequest(
method=request.method,
url='%s://s3.amazonaws.com/%s%s' % (scheme, bucket, path),
headers=request.headers.to_native_string_dict(),
headers=request.headers.to_unicode_dict(),
data=request.body)
self._signer.add_auth(awsrequest)
request = request.replace(

View File

@ -79,7 +79,10 @@ class Headers(CaselessDict):
def to_string(self):
return headers_dict_to_raw(self)
def to_native_string_dict(self):
def to_unicode_dict(self):
""" Return headers as a CaselessDict with unicode keys
and unicode values. Multiple values are joined with ','.
"""
return CaselessDict(
(to_unicode(key, encoding=self.encoding),
to_unicode(b','.join(value), encoding=self.encoding))