本文整理匯總了Python中wsgiref.handlers.SimpleHandler.close方法的典型用法代碼示例。如果您正苦於以下問題:Python SimpleHandler.close方法的具體用法?Python SimpleHandler.close怎麽用?Python SimpleHandler.close使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類wsgiref.handlers.SimpleHandler
的用法示例。
在下文中一共展示了SimpleHandler.close方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: finish_request
# 需要導入模塊: from wsgiref.handlers import SimpleHandler [as 別名]
# 或者: from wsgiref.handlers.SimpleHandler import close [as 別名]
def finish_request(self, request, client_address):
"""
Negotiates SSL and then mimics BaseServer behavior.
"""
request.settimeout(1.0)
try:
ssock = ssl.wrap_socket(
request,
keyfile=os.path.join(CERT_DIR, 'key.pem'),
certfile=os.path.join(CERT_DIR, 'cert.pem'),
server_side=True,
suppress_ragged_eofs=False,
)
self.RequestHandlerClass(ssock, client_address, self)
except Exception as e:
print("pytest-httpbin server hit an exception serving request: %s" % e)
print("attempting to ignore so the rest of the tests can run")
# WSGIRequestHandler seems to close the socket for us.
# Thanks, WSGIRequestHandler!!
示例2: close
# 需要導入模塊: from wsgiref.handlers import SimpleHandler [as 別名]
# 或者: from wsgiref.handlers.SimpleHandler import close [as 別名]
def close(self):
try:
self.request_handler.log_request(
self.status.split(' ',1)[0], self.bytes_sent
)
finally:
SimpleHandler.close(self)
示例3: close
# 需要導入模塊: from wsgiref.handlers import SimpleHandler [as 別名]
# 或者: from wsgiref.handlers.SimpleHandler import close [as 別名]
def close(self):
try:
self.request_handler.log_request(
self.status.split(' ', 1)[0], self.bytes_sent
)
finally:
SimpleHandler.close(self)