def connect(self):
if self.client is None:
# Suds library doesn't support passing unverified context to disable
# server certificate verification. Thus disable checking globally in
# order to skip verification. This is not recommended in production
# code. see https://www.python.org/dev/peps/pep-0476/
if self.skip_verification:
import ssl
try:
_create_unverified_https_context = \
ssl._create_unverified_context
except AttributeError:
# Legacy Python that doesn't verify HTTPS certificates by
# default
pass
else:
# Handle target environment that doesn't support HTTPS
# verification
ssl._create_default_https_context = \
_create_unverified_https_context
self.client = Client(url=self.wsdl_url, location=self.soap_url)
assert self.client is not None
self.client.set_options(service='LsService', port='LsPort')
self.managedObjectReference = self.client.factory.create(
'ns0:ManagedObjectReference')
self.managedObjectReference._type = 'LookupServiceInstance'
self.managedObjectReference.value = 'ServiceInstance'
lookupServiceContent = self.client.service.RetrieveServiceContent(
self.managedObjectReference)
self.serviceRegistration = lookupServiceContent.serviceRegistration
lookup_service_helper.py 文件源码
python
阅读 24
收藏 0
点赞 0
评论 0
评论列表
文章目录