本文整理汇总了Python中botocore.compat.HTTPHeaders方法的典型用法代码示例。如果您正苦于以下问题:Python compat.HTTPHeaders方法的具体用法?Python compat.HTTPHeaders怎么用?Python compat.HTTPHeaders使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类botocore.compat
的用法示例。
在下文中一共展示了compat.HTTPHeaders方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from botocore import compat [as 别名]
# 或者: from botocore.compat import HTTPHeaders [as 别名]
def __init__(self, *args, **kwargs):
self.auth_path = None
if 'auth_path' in kwargs:
self.auth_path = kwargs['auth_path']
del kwargs['auth_path']
models.Request.__init__(self, *args, **kwargs)
headers = HTTPHeaders()
if self.headers is not None:
for key, value in self.headers.items():
headers[key] = value
self.headers = headers
# This is a dictionary to hold information that is used when
# processing the request. What is inside of ``context`` is open-ended.
# For example, it may have a timestamp key that is used for holding
# what the timestamp is when signing the request. Note that none
# of the information that is inside of ``context`` is directly
# sent over the wire; the information is only used to assist in
# creating what is sent over the wire.
self.context = {}
示例2: headers_to_sign
# 需要导入模块: from botocore import compat [as 别名]
# 或者: from botocore.compat import HTTPHeaders [as 别名]
def headers_to_sign(self, request):
"""
Select the headers from the request that need to be included
in the StringToSign.
"""
header_map = HTTPHeaders()
for name, value in request.headers.items():
lname = name.lower()
if lname not in SIGNED_HEADERS_BLACKLIST:
header_map[lname] = value
if 'host' not in header_map:
# Ensure we sign the lowercased version of the host, as that
# is what will ultimately be sent on the wire.
# TODO: We should set the host ourselves, instead of relying on our
# HTTP client to set it for us.
header_map['host'] = self._canonical_host(request.url).lower()
return header_map
示例3: headers_to_sign
# 需要导入模块: from botocore import compat [as 别名]
# 或者: from botocore.compat import HTTPHeaders [as 别名]
def headers_to_sign(self, request):
"""
Select the headers from the request that need to be included
in the StringToSign.
"""
header_map = HTTPHeaders()
split = urlsplit(request.url)
for name, value in request.headers.items():
lname = name.lower()
if lname not in SIGNED_HEADERS_BLACKLIST:
header_map[lname] = value
if 'host' not in header_map:
header_map['host'] = split.netloc
return header_map
示例4: headers_to_sign
# 需要导入模块: from botocore import compat [as 别名]
# 或者: from botocore.compat import HTTPHeaders [as 别名]
def headers_to_sign(self, request):
"""
Select the headers from the request that need to be included
in the StringToSign.
"""
header_map = HTTPHeaders()
for name, value in request.headers.items():
lname = name.lower()
if lname not in SIGNED_HEADERS_BLACKLIST:
header_map[lname] = value
if 'host' not in header_map:
header_map['host'] = self._canonical_host(request.url)
return header_map