本文整理汇总了Python中pyramid.response.Response.headers["X-Weave-Alert"]方法的典型用法代码示例。如果您正苦于以下问题:Python Response.headers["X-Weave-Alert"]方法的具体用法?Python Response.headers["X-Weave-Alert"]怎么用?Python Response.headers["X-Weave-Alert"]使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyramid.response.Response
的用法示例。
在下文中一共展示了Response.headers["X-Weave-Alert"]方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: hard_eol
# 需要导入模块: from pyramid.response import Response [as 别名]
# 或者: from pyramid.response.Response import headers["X-Weave-Alert"] [as 别名]
def hard_eol(request):
"""Send a 513 SERVICE EOL response.
This is the special response that triggers EOL messaging in the client
app. We send it on every request that we possibly can, excluding only
those for which the error-handling route is buggy.
"""
settings = request.registry.settings
response = Response("0")
response.status = "513 SERVICE EOL"
response.content_type = "application/json"
response.headers["X-Weave-Alert"] = json.dumps({
"code": "hard-eol",
"url": settings.get("sync11eol.url", DEFAULT_EOL_URL),
"message": settings.get("sync11eol.message", DEFAULT_EOL_MESSAGE),
})
return response