本文整理汇总了Python中http.server.SimpleHTTPRequestHandler.setup方法的典型用法代码示例。如果您正苦于以下问题:Python SimpleHTTPRequestHandler.setup方法的具体用法?Python SimpleHTTPRequestHandler.setup怎么用?Python SimpleHTTPRequestHandler.setup使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类http.server.SimpleHTTPRequestHandler
的用法示例。
在下文中一共展示了SimpleHTTPRequestHandler.setup方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setup
# 需要导入模块: from http.server import SimpleHTTPRequestHandler [as 别名]
# 或者: from http.server.SimpleHTTPRequestHandler import setup [as 别名]
def setup(self):
"""Override SocketServer.StreamRequestHandler.setup to wrap rfile
with MemorizingFile.
This method will be called by BaseRequestHandler's constructor
before calling BaseHTTPRequestHandler.handle.
BaseHTTPRequestHandler.handle will call
BaseHTTPRequestHandler.handle_one_request and it will call
_WebSocketRequestHandler.parse_request.
"""
# Call superclass's setup to prepare rfile, wfile, etc. See setup
# definition on the root class SocketServer.StreamRequestHandler to
# understand what this does.
SimpleHTTPRequestHandler.setup(self)
self.rfile = memorizingfile.MemorizingFile(
self.rfile,
max_memorized_lines=_MAX_MEMORIZED_LINES)
示例2: setup
# 需要导入模块: from http.server import SimpleHTTPRequestHandler [as 别名]
# 或者: from http.server.SimpleHTTPRequestHandler import setup [as 别名]
def setup(self):
SimpleHTTPRequestHandler.setup(self)
if self.disable_nagle_algorithm:
self.connection.setsockopt(socket.IPPROTO_TCP,
socket.TCP_NODELAY, True)
示例3: setup
# 需要导入模块: from http.server import SimpleHTTPRequestHandler [as 别名]
# 或者: from http.server.SimpleHTTPRequestHandler import setup [as 别名]
def setup(self):
SimpleHTTPRequestHandler.setup(self)
self.request.settimeout(3)