本文整理匯總了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)