本文整理汇总了Python中twisted.internet.ssl.ClientContextFactory.getContext方法的典型用法代码示例。如果您正苦于以下问题:Python ClientContextFactory.getContext方法的具体用法?Python ClientContextFactory.getContext怎么用?Python ClientContextFactory.getContext使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类twisted.internet.ssl.ClientContextFactory
的用法示例。
在下文中一共展示了ClientContextFactory.getContext方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: getContext
# 需要导入模块: from twisted.internet.ssl import ClientContextFactory [as 别名]
# 或者: from twisted.internet.ssl.ClientContextFactory import getContext [as 别名]
def getContext(self, hostname, port):
return ClientContextFactory.getContext(self)
示例2: getContext
# 需要导入模块: from twisted.internet.ssl import ClientContextFactory [as 别名]
# 或者: from twisted.internet.ssl.ClientContextFactory import getContext [as 别名]
def getContext(self, hostname, port):
return ClientContextFactory.getContext(self)
示例3: getContext
# 需要导入模块: from twisted.internet.ssl import ClientContextFactory [as 别名]
# 或者: from twisted.internet.ssl.ClientContextFactory import getContext [as 别名]
def getContext(self, hostname=None, port=None):
return self.getCertificateOptions().getContext()
示例4: creatorForNetloc
# 需要导入模块: from twisted.internet.ssl import ClientContextFactory [as 别名]
# 或者: from twisted.internet.ssl.ClientContextFactory import getContext [as 别名]
def creatorForNetloc(self, hostname, port):
return ScrapyClientTLSOptions(hostname.decode("ascii"), self.getContext())
示例5: getContext
# 需要导入模块: from twisted.internet.ssl import ClientContextFactory [as 别名]
# 或者: from twisted.internet.ssl.ClientContextFactory import getContext [as 别名]
def getContext(self, hostname, port):
raise NotImplementedError("SSL support unavailable")
示例6: create_agent
# 需要导入模块: from twisted.internet.ssl import ClientContextFactory [as 别名]
# 或者: from twisted.internet.ssl.ClientContextFactory import getContext [as 别名]
def create_agent(self):
if HAS_OPENSSL:
class WebClientContextFactory(ClientContextFactory):
"""TODO: enable certificate verification, hostname checking"""
def getContext(self, hostname, port):
return ClientContextFactory.getContext(self)
return Agent(reactor, WebClientContextFactory())
else:
return Agent(reactor)