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