本文整理汇总了Python中suds.properties.Unskin类的典型用法代码示例。如果您正苦于以下问题:Python Unskin类的具体用法?Python Unskin怎么用?Python Unskin使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Unskin类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: set_options
def set_options(self, **kwargs):
"""
Set options.
@param kwargs: keyword arguments.
@see: L{Options}
"""
p = Unskin(self.options)
p.update(kwargs)
开发者ID:jonathan-hepp,项目名称:suds,代码行数:8,代码来源:client.py
示例2: _getHttpsPolicy
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
开发者ID:aronbierbaum,项目名称:txsuds,代码行数:42,代码来源:twisted_transport.py
示例3: clone
def clone(self):
"""
Get a shallow clone of this object.
The clone only shares the WSDL. All other attributes are
unique to the cloned object including options.
@return: A shallow clone.
@rtype: L{Client}
"""
class Uninitialized(Client):
def __init__(self):
pass
clone = Uninitialized()
clone.options = Options()
cp = Unskin(clone.options)
mp = Unskin(self.options)
cp.update(deepcopy(mp))
clone.wsdl = self.wsdl
clone.factory = self.factory
clone.service = ServiceSelector(clone, self.wsdl.services)
clone.sd = self.sd
clone.messages = dict(tx=None, rx=None)
return clone
开发者ID:jonathan-hepp,项目名称:suds,代码行数:22,代码来源:client.py
示例4: __deepcopy__
def __deepcopy__(self, memo={}):
clone = self.__class__()
p = Unskin(self.options)
cp = Unskin(clone.options)
cp.update(p)
return clone
开发者ID:EASYMARKETING,项目名称:suds-jurko,代码行数:6,代码来源:http.py
示例5: __init__
def __init__(self, server=None, username=None, password=None,
wsdl_location="local", timeout=30, init_clone=False, clone=None):
#self._init_logging()
self._logged_in = False
if server is None:
server = _config_value("general", "server")
if username is None:
username = _config_value("general", "username")
if password is None:
password = _config_value("general", "password")
if server is None:
raise ConfigError("server must be set in config file or Client()")
if username is None:
raise ConfigError("username must be set in config file or Client()")
if password is None:
raise ConfigError("password must be set in config file or Client()")
self.server = server
self.username = username
self.password = password
url = "https://%s/sdk" % self.server
if wsdl_location == "local":
current_path = os.path.abspath(os.path.dirname(__file__))
current_path = current_path.replace('\\', '/')
if not current_path.startswith('/') :
current_path = '/' + current_path
if current_path.endswith('/') :
current_path = current_path[:-1]
wsdl_uri = ("file://%s/wsdl/vimService.wsdl" % current_path)
elif wsdl_location == "remote":
wsdl_uri = url + "/vimService.wsdl"
else:
print("FATAL: wsdl_location must be \"local\" or \"remote\"")
sys.exit(1)
# Init the base class
if clone:
self.sd=clone.sd
self.options = Options()
cp = Unskin(self.options)
mp = Unskin(clone.options)
cp.update(deepcopy(mp))
self.wsdl = clone.wsdl
self.factory = clone.factory
self.service = ServiceSelector(self, clone.wsdl.services)
self.messages = dict(tx=None, rx=None)
else:
try:
suds.client.Client.__init__(self, wsdl_uri)
except URLError:
logger.critical("Failed to connect to %s" % self.server)
raise
except IOError:
logger.critical("Failed to load the local WSDL from %s" % wsdl_uri)
raise
except TransportError:
logger.critical("Failed to load the remote WSDL from %s" % wsdl_uri)
raise
if init_clone:
return
self.options.transport.options.timeout = timeout
self.set_options(location=url)
mo_ref = soap.ManagedObjectReference("ServiceInstance",
"ServiceInstance")
self.si = ServiceInstance(mo_ref, self)
try:
self.sc = self.si.RetrieveServiceContent()
except URLError, e:
#print("Failed to connect to %s" % self.server)
#print("urllib2 said: %s" % e.reason)
#sys.exit(1)
raise
开发者ID:rzenker,项目名称:psphere-daemon,代码行数:70,代码来源:client.py
示例6: location
def location(self):
p = Unskin(self.options)
return p.get('location', self.method.location)
开发者ID:jonathan-hepp,项目名称:suds,代码行数:3,代码来源:client.py
注:本文中的suds.properties.Unskin类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论