本文整理汇总了Python中Server.Server.subject方法的典型用法代码示例。如果您正苦于以下问题:Python Server.subject方法的具体用法?Python Server.subject怎么用?Python Server.subject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Server.Server
的用法示例。
在下文中一共展示了Server.subject方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: connect_to_server
# 需要导入模块: from Server import Server [as 别名]
# 或者: from Server.Server import subject [as 别名]
def connect_to_server(self, hostname, port):
"""Handle connection to desired server
Handles checking of certificate.
Return Server instance."""
self.logger.info("Connecting to %s:%s" % (hostname, port))
try:
server = Server(hostname, port)
except Exception as e:
self.logger.error("Error connecting to %s:%s: %s" % (hostname, port, e))
raise
self.logger.debug("Server subject is %s" % server.subject().as_text())
self.logger.info("Checking certificate with Perspectives")
try:
fingerprint = server.get_fingerprint()
service = Service(hostname, port)
self.checker.check_seen_fingerprint(service, fingerprint)
except PerspectivesException as e:
self.logger.error("Perspectives check failed: %s" % str(e))
raise
self.logger.debug("Connection to server established")
return server
示例2: connect_to_server
# 需要导入模块: from Server import Server [as 别名]
# 或者: from Server.Server import subject [as 别名]
def connect_to_server(self, hostname, port):
"""Handle connection to desired server
Handles checking of certificate.
Return Server instance."""
self.logger.info("Connecting to %s:%s" % (hostname, port))
try:
server = Server(hostname, port)
except Exception as e:
self.logger.error("Error connecting to %s:%s: %s" % (hostname,
port,
e))
raise
self.logger.debug("Server subject is %s" % (server.subject().as_text()))
self.check_server(server)
self.logger.debug("Connection to server established")
return server