本文整理汇总了Python中werkzeug.exceptions.HTTPException.get_headers方法的典型用法代码示例。如果您正苦于以下问题:Python HTTPException.get_headers方法的具体用法?Python HTTPException.get_headers怎么用?Python HTTPException.get_headers使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类werkzeug.exceptions.HTTPException
的用法示例。
在下文中一共展示了HTTPException.get_headers方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_headers
# 需要导入模块: from werkzeug.exceptions import HTTPException [as 别名]
# 或者: from werkzeug.exceptions.HTTPException import get_headers [as 别名]
def get_headers(self, environ=None):
"""Get a list of headers."""
return [("Content-Type", "text/html")]
示例2: get_response
# 需要导入模块: from werkzeug.exceptions import HTTPException [as 别名]
# 或者: from werkzeug.exceptions.HTTPException import get_headers [as 别名]
def get_response(self, environ=None):
"""Get a response object. If one was passed to the exception
it's returned directly.
:param environ: the optional environ for the request. This
can be used to modify the response depending
on how the request looked like.
:return: a :class:`Response` object or a subclass thereof.
"""
if self.response is not None:
return self.response
if environ is not None:
environ = _get_environ(environ)
headers = self.get_headers(environ)
return Response(self.get_body(environ), self.code, headers)
示例3: get_headers
# 需要导入模块: from werkzeug.exceptions import HTTPException [as 别名]
# 或者: from werkzeug.exceptions.HTTPException import get_headers [as 别名]
def get_headers(self, environ=None):
"""Get a list of headers."""
return [('Content-Type', 'text/html')]
示例4: get_headers
# 需要导入模块: from werkzeug.exceptions import HTTPException [as 别名]
# 或者: from werkzeug.exceptions.HTTPException import get_headers [as 别名]
def get_headers(self, environ=None):
headers = HTTPException.get_headers(self, environ)
if self.www_authenticate:
headers.append(
("WWW-Authenticate", ", ".join([str(x) for x in self.www_authenticate]))
)
return headers