本文整理汇总了Python中suds.properties.Unskin.definition方法的典型用法代码示例。如果您正苦于以下问题:Python Unskin.definition方法的具体用法?Python Unskin.definition怎么用?Python Unskin.definition使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类suds.properties.Unskin
的用法示例。
在下文中一共展示了Unskin.definition方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _getHttpsPolicy
# 需要导入模块: from suds.properties import Unskin [as 别名]
# 或者: from suds.properties.Unskin import definition [as 别名]
def _getHttpsPolicy(self):
"""
Helper method that lazily constructs the HTTPS options to use for this
transport.
"""
if self._httpsPolicy is not None:
return self._httpsPolicy
# Attempt to load the certificate and private key from a file.
certificate = None
if self.options.certificate:
cert_data = self.options.certificate
if os.path.isfile(cert_data):
with open(cert_data, "rb") as cert_file:
cert_data = cert_file.read()
certificate = crypto.load_certificate(crypto.FILETYPE_PEM, cert_data)
priv_key = None
if self.options.privateKey:
key_data = self.options.privateKey
if os.path.isfile(key_data):
with open(key_data, "rb") as key_file:
key_data = key_file.read()
priv_key = crypto.load_privatekey(crypto.FILETYPE_PEM, key_data)
# Get the rest of the options for the context factory.
other_opts = {}
props = Unskin(self.options)
for opt_name in ['method', 'verify', 'caCerts', 'verifyDepth', 'trustRoot',
'requireCertificate', 'verifyOnce', 'enableSingleUseKeys',
'enableSessions', 'fixBrokenPeers', 'enableSessionTickets',
'acceptableCiphers']:
val = getattr(self.options, opt_name)
# Only pass values that have been specified because OpenSSLCertificateOptions
# uses _mutuallyExclusiveArguments.
if val != props.definition(opt_name).default:
other_opts[opt_name] = val
self._httpsPolicy = PolicyForHTTPS(privateKey = priv_key,
certificate = certificate,
**other_opts)
return self._httpsPolicy