本文整理汇总了Python中swift.common.header_key_dict.HeaderKeyDict.keys方法的典型用法代码示例。如果您正苦于以下问题:Python HeaderKeyDict.keys方法的具体用法?Python HeaderKeyDict.keys怎么用?Python HeaderKeyDict.keys使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类swift.common.header_key_dict.HeaderKeyDict
的用法示例。
在下文中一共展示了HeaderKeyDict.keys方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _clean_outgoing_headers
# 需要导入模块: from swift.common.header_key_dict import HeaderKeyDict [as 别名]
# 或者: from swift.common.header_key_dict.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():
if h in self.outgoing_allow_headers:
continue
for p in self.outgoing_allow_headers_startswith:
if h.startswith(p):
break
else:
if h in self.outgoing_remove_headers:
del headers[h]
continue
for p in self.outgoing_remove_headers_startswith:
if h.startswith(p):
del headers[h]
break
return headers.items()
示例2: test_keys
# 需要导入模块: from swift.common.header_key_dict import HeaderKeyDict [as 别名]
# 或者: from swift.common.header_key_dict.HeaderKeyDict import keys [as 别名]
def test_keys(self):
headers = HeaderKeyDict()
headers['content-length'] = 20
headers['cOnTent-tYpe'] = 'text/plain'
headers['SomeThing-eLse'] = 'somevalue'
self.assertEqual(
set(headers.keys()),
set(('Content-Length', 'Content-Type', 'Something-Else')))
示例3: test_keys
# 需要导入模块: from swift.common.header_key_dict import HeaderKeyDict [as 别名]
# 或者: from swift.common.header_key_dict.HeaderKeyDict import keys [as 别名]
def test_keys(self):
headers = HeaderKeyDict()
headers["content-length"] = 20
headers["cOnTent-tYpe"] = "text/plain"
headers["SomeThing-eLse"] = "somevalue"
self.assertEqual(set(headers.keys()), set(("Content-Length", "Content-Type", "Something-Else")))