本文整理汇总了Python中twisted.web.server.Request.connectionLost方法的典型用法代码示例。如果您正苦于以下问题:Python Request.connectionLost方法的具体用法?Python Request.connectionLost怎么用?Python Request.connectionLost使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类twisted.web.server.Request
的用法示例。
在下文中一共展示了Request.connectionLost方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: connectionLost
# 需要导入模块: from twisted.web.server import Request [as 别名]
# 或者: from twisted.web.server.Request import connectionLost [as 别名]
def connectionLost(self, reason):
"""Called when the client connection is closed before the response is written.
Overrides twisted.web.server.Request.connectionLost to record the finish time and
do logging.
"""
self.finish_time = time.time()
Request.connectionLost(self, reason)
# we only get here if the connection to the client drops before we send
# the response.
#
# It's useful to log it here so that we can get an idea of when
# the client disconnects.
with PreserveLoggingContext(self.logcontext):
logger.warn(
"Error processing request %r: %s %s", self, reason.type, reason.value,
)
if not self._is_processing:
self._finished_processing()