本文整理汇总了Python中future.backports.test.support.verbose方法的典型用法代码示例。如果您正苦于以下问题:Python support.verbose方法的具体用法?Python support.verbose怎么用?Python support.verbose使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类future.backports.test.support
的用法示例。
在下文中一共展示了support.verbose方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: make_https_server
# 需要导入模块: from future.backports.test import support [as 别名]
# 或者: from future.backports.test.support import verbose [as 别名]
def make_https_server(case, certfile=CERTFILE, host=HOST, handler_class=None):
# we assume the certfile contains both private key and certificate
context = ssl.SSLContext(ssl.PROTOCOL_SSLv23)
context.load_cert_chain(certfile)
server = HTTPSServerThread(context, host, handler_class)
flag = threading.Event()
server.start(flag)
flag.wait()
def cleanup():
if support.verbose:
sys.stdout.write('stopping HTTPS server\n')
server.stop()
if support.verbose:
sys.stdout.write('joining HTTPS thread\n')
server.join()
case.addCleanup(cleanup)
return server
示例2: get_request
# 需要导入模块: from future.backports.test import support [as 别名]
# 或者: from future.backports.test.support import verbose [as 别名]
def get_request(self):
# override this to wrap socket with SSL
try:
sock, addr = self.socket.accept()
sslconn = self.context.wrap_socket(sock, server_side=True)
except socket.error as e:
# socket errors are silenced by the caller, print them here
if support.verbose:
sys.stderr.write("Got an error:\n%s\n" % e)
raise
return sslconn, addr
示例3: log_message
# 需要导入模块: from future.backports.test import support [as 别名]
# 或者: from future.backports.test.support import verbose [as 别名]
def log_message(self, format, *args):
# we override this to suppress logging unless "verbose"
if support.verbose:
sys.stdout.write(" server (%s:%d %s):\n [%s] %s\n" %
(self.server.server_address,
self.server.server_port,
self.request.cipher(),
self.log_date_time_string(),
format%args))
示例4: log_request
# 需要导入模块: from future.backports.test import support [as 别名]
# 或者: from future.backports.test.support import verbose [as 别名]
def log_request(self, format, *args):
if support.verbose:
BaseHTTPRequestHandler.log_request(self, format, *args)