本文整理汇总了Python中botocore.compat.ensure_unicode方法的典型用法代码示例。如果您正苦于以下问题:Python compat.ensure_unicode方法的具体用法?Python compat.ensure_unicode怎么用?Python compat.ensure_unicode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类botocore.compat
的用法示例。
在下文中一共展示了compat.ensure_unicode方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _get_user_agent
# 需要导入模块: from botocore import compat [as 别名]
# 或者: from botocore.compat import ensure_unicode [as 别名]
def _get_user_agent(self, request_headers):
return self._truncate(
ensure_unicode(request_headers.get('User-Agent', '')),
self._MAX_USER_AGENT_LENGTH
)
示例2: _get_auth_value
# 需要导入模块: from botocore import compat [as 别名]
# 或者: from botocore.compat import ensure_unicode [as 别名]
def _get_auth_value(self, request_headers):
return ensure_unicode(request_headers['Authorization'])
示例3: canonical_headers
# 需要导入模块: from botocore import compat [as 别名]
# 或者: from botocore.compat import ensure_unicode [as 别名]
def canonical_headers(self, headers_to_sign):
"""
Return the headers that need to be included in the StringToSign
in their canonical form by converting all header keys to lower
case, sorting them in alphabetical order and then joining
them into a string, separated by newlines.
"""
headers = []
sorted_header_names = sorted(set(headers_to_sign))
for key in sorted_header_names:
value = ','.join(self._header_value(v) for v in
sorted(headers_to_sign.get_all(key)))
headers.append('%s:%s' % (key, ensure_unicode(value)))
return '\n'.join(headers)
示例4: _serialize_request_headers
# 需要导入模块: from botocore import compat [as 别名]
# 或者: from botocore.compat import ensure_unicode [as 别名]
def _serialize_request_headers(self, request_headers, event_dict,
**kwargs):
if 'User-Agent' in request_headers:
event_dict['UserAgent'] = self._truncate(
ensure_unicode(request_headers['User-Agent']),
self._MAX_USER_AGENT_LENGTH
)
if self._is_signed(request_headers):
event_dict['AccessKey'] = self._get_access_key(request_headers)
region = self._get_region(request_headers)
if region is not None:
event_dict['Region'] = region
if 'X-Amz-Security-Token' in request_headers:
event_dict['SessionToken'] = request_headers[
'X-Amz-Security-Token']