本文整理汇总了Python中swift.common.swob.HeaderKeyDict.keys方法的典型用法代码示例。如果您正苦于以下问题:Python HeaderKeyDict.keys方法的具体用法?Python HeaderKeyDict.keys怎么用?Python HeaderKeyDict.keys使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类swift.common.swob.HeaderKeyDict
的用法示例。
在下文中一共展示了HeaderKeyDict.keys方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _clean_outgoing_headers
# 需要导入模块: from swift.common.swob import HeaderKeyDict [as 别名]
# 或者: from swift.common.swob.HeaderKeyDict import keys [as 别名]
def _clean_outgoing_headers(self, headers):
"""
Removes any headers as per the middleware configuration for
outgoing responses.
:param headers: A WSGI start_response style list of headers,
[('header1', 'value), ('header2', 'value),
...]
:returns: The same headers list, but with some headers
removed as per the middlware configuration for
outgoing responses.
"""
headers = HeaderKeyDict(headers)
for h in headers.keys():
remove = h in self.outgoing_remove_headers
if not remove:
for p in self.outgoing_remove_headers_startswith:
if h.startswith(p):
remove = True
break
if remove:
if h in self.outgoing_allow_headers:
remove = False
if remove:
for p in self.outgoing_allow_headers_startswith:
if h.startswith(p):
remove = False
break
if remove:
del headers[h]
return headers.items()