本文整理汇总了Python中suds.client方法的典型用法代码示例。如果您正苦于以下问题:Python suds.client方法的具体用法?Python suds.client怎么用?Python suds.client使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类suds
的用法示例。
在下文中一共展示了suds.client方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: createFilter
# 需要导入模块: import suds [as 别名]
# 或者: from suds import client [as 别名]
def createFilter(self):
oSpec = self.objectSpec()
oSpec.obj = self.sc.rootFolder
oSpec.selectSet = self.buildFullTraversal()
pfs = self.propertyFilterSpec()
pfs.objectSet = [oSpec]
pfs.propSet = [
self.createPropertySpec("VirtualMachine", ["config.uuid", "config.version", "runtime.powerState"]),
self.createPropertySpec("ClusterComputeResource", ["name"]),
self.createPropertySpec("HostSystem", ["name",
"vm",
"hardware.systemInfo.uuid",
"hardware.cpuInfo.numCpuPackages",
"parent",
"config.product.name",
"config.product.version",
"config.network.dnsConfig.hostName",
"config.network.dnsConfig.domainName"])
]
try:
return self.client.service.CreateFilter(_this=self.sc.propertyCollector, spec=pfs, partialUpdates=0)
except requests.RequestException as e:
raise virt.VirtError(str(e))
示例2: getColoredPathwayTest
# 需要导入模块: import suds [as 别名]
# 或者: from suds import client [as 别名]
def getColoredPathwayTest():
fileType = 'png' ### svg, pdf
graphId="ffffff90"; wpid = "WP2062"; color = "0000ff"
graphId=["ffffff90","ffffffe5"]
color = ["0000ff","0000ff"]
### revision = 0 is the most current version
#file = client.service.getColoredPathway(pwId=wpid,revision=0,graphId=graphId,color=color,fileType=fileType)
kwargs = {
'identifier': 'WP2062',
'version': 0,
'element_identifiers': ["ffffff90","ffffffe5"],
'colors': ["#0000FF","#0000FF"],
'file_format': 'image/svg+xml'}
file = wikipathways_api_client_instance.get_colored_pathway(identifier=wpid,version=0,element_identifiers=graphId,colors=color,file_format=fileType)
#file = base64.b64decode(file) ### decode this file
outfile = export.ExportFile(wpid+'.png')
outfile.write(file); outfile.close()
示例3: setUp
# 需要导入模块: import suds [as 别名]
# 或者: from suds import client [as 别名]
def setUp(self):
self.client = Client('http://www.thomas-bayer.com/axis2/services/BLZService?wsdl')
示例4: test_service_representation
# 需要导入模块: import suds [as 别名]
# 或者: from suds import client [as 别名]
def test_service_representation(self):
string_rep = str(self.client)
ver = suds.__version__
build = suds.__build__.split()[1]
expected = """
Suds ( https://github.com/cackharot/suds-py3 ) version: %s IN build: %s
Service ( BLZService ) tns="http://thomas-bayer.com/blz/"
Prefixes (1)
ns0 = "http://thomas-bayer.com/blz/"
Ports (2):
(BLZServiceSOAP11port_http)
Methods (1):
getBank(xs:string blz, )
Types (3):
detailsType
getBankResponseType
getBankType
(BLZServiceSOAP12port_http)
Methods (1):
getBank(xs:string blz, )
Types (3):
detailsType
getBankResponseType
getBankType
--------------------------------------------------------------------------------""" % (ver, build)
self.assertEqual(string_rep, expected)
示例5: _cancel_wait
# 需要导入模块: import suds [as 别名]
# 或者: from suds import client [as 别名]
def _cancel_wait(self):
try:
self.client.service.CancelWaitForUpdates(_this=self.sc.propertyCollector)
except Exception:
pass
示例6: cleanup
# 需要导入模块: import suds [as 别名]
# 或者: from suds import client [as 别名]
def cleanup(self):
self._cancel_wait()
if self.filter is not None:
try:
self.client.service.DestroyPropertyFilter(self.filter)
except suds.WebFault:
pass
self.filter = None
self.logout()
示例7: logout
# 需要导入模块: import suds [as 别名]
# 或者: from suds import client [as 别名]
def logout(self):
""" Log out from ESX. """
try:
if self.sc:
self.client.service.Logout(_this=self.sc.sessionManager)
self.sc = None
except Exception as e:
self.logger.info("Can't log out from ESX: %s", str(e))
示例8: traversalSpec
# 需要导入模块: import suds [as 别名]
# 或者: from suds import client [as 别名]
def traversalSpec(self):
return self.client.factory.create('ns0:TraversalSpec')
示例9: selectionSpec
# 需要导入模块: import suds [as 别名]
# 或者: from suds import client [as 别名]
def selectionSpec(self):
return self.client.factory.create('ns0:SelectionSpec')
示例10: propertyFilterSpec
# 需要导入模块: import suds [as 别名]
# 或者: from suds import client [as 别名]
def propertyFilterSpec(self):
return self.client.factory.create('ns0:PropertyFilterSpec')
示例11: createPropertySpec
# 需要导入模块: import suds [as 别名]
# 或者: from suds import client [as 别名]
def createPropertySpec(self, type, pathSet, all=False):
pSpec = self.client.factory.create('ns0:PropertySpec')
pSpec.all = all
pSpec.type = type
pSpec.pathSet = pathSet
return pSpec
示例12: getPathwayAs
# 需要导入模块: import suds [as 别名]
# 或者: from suds import client [as 别名]
def getPathwayAs(pathway_db,species_code,mod):
begin_time = time.time()
for wpid in pathway_db:
#print [wpid],'pathway_db',len(pathway_db)
file_type = 'gpml'
#file_type = 'application/gpml+xml'
processor_time = str(time.clock())
#try: export.deleteFolder('BuildDBs/WPs') ### clear any remaining pathway files
#except Exception: pass
#wp_id_data = client.service.getPathwayAs(fileType = file_type,pwId = wpid, revision = 0)
kwargs = {
'identifier': 'WP2062',
'version': 0,
'file_format': 'application/gpml+xml'}
#wp_id_data = wikipathways_api_client_instance.get_pathway_as(**kwargs)
wp_id_data = wikipathways_api_client_instance.get_pathway_as(file_format = file_type,identifier = wpid, version = 0)
#wp_id_data = base64.b64decode(wp_id_data)
gpml_path = filepath('BuildDBs/WPs/'+processor_time+'/'+wpid+'.gpml')
#print gpml_path
outfile = export.ExportFile(gpml_path)
outfile.write(wp_id_data); outfile.close()
gene_system_list = string.split(wp_id_data,'\n')
parent_path = export.findParentDir(gpml_path)
pathway_db = gene_associations.getGPMLGraphData(parent_path,species_code,mod) ### get GPML data back
#os.remove(gpml_path) ### Only store the file temporarily
try: export.deleteFolder('BuildDBs/WPs/'+processor_time) ### clear any remaining pathway files
except Exception: pass
end_time = time.time(); time_diff = float(end_time-begin_time)
"""
try: print "WikiPathways data imported in %d seconds" % time_diff
except Exception: null=None ### Occurs when transitioning back from the Official Database download window (not sure why) -- TclError: can't invoke "update" command
"""
return pathway_db
示例13: getColoredPathway
# 需要导入模块: import suds [as 别名]
# 或者: from suds import client [as 别名]
def getColoredPathway(root_dir,graphID_db,file_type,dataset_name,WPID=None):
for (wpid,name) in graphID_db:
### Example: graphId="ffffff90"; wpid = "WP2062"; color = "0000ff"
if WPID==wpid or WPID==None:
graphID_list = []
hex_color_list = []
for graphID in graphID_db[(wpid,name)]:
graphID_list.append(graphID)
hex_color_list.append(graphID_db[(wpid,name)][graphID]) ### order is thus the same for both
#hex_color_list = ["0000ff"]*11
#print len(graphID_list),graphID_list
#print len(hex_color_list),hex_color_list
#print file_type
if len(graphID_list)==0:
continue
### revision = 0 is the most current version
#file = client.service.getColoredPathway(pwId=wpid,revision=0,graphId=graphID_list,color=hex_color_list,fileType=file_type)
file = wikipathways_api_client_instance.get_colored_pathway(identifier=wpid,version=0,
element_identifiers=graphID_list,colors=hex_color_list,file_format=file_type)
#file = base64.b64decode(file) ### decode this file
name = string.replace(name,':','-')
name = string.replace(name,'/','-')
name = string.replace(name,'\\','-') ### will otherwise create a sub-directory
output_filename = root_dir+wpid+'_'+name+dataset_name+'.'+file_type
outfile = export.ExportFile(output_filename)
if file_type == 'png':
if wpid == 'WP2062': ### This is the LineageMapp
graphic_link.append(('LineageProfiler'+dataset_name,output_filename))
else:
graphic_link['WP'] = output_filename
outfile.write(file); outfile.close()
#http://au.answers.yahoo.com/question/index?qid=20111029100100AAqxS8l
#http://stackoverflow.com/questions/2374427/python-2-x-write-binary-output-to-stdout
示例14: getAllSpeciesPathways
# 需要导入模块: import suds [as 别名]
# 或者: from suds import client [as 别名]
def getAllSpeciesPathways(species_full):
#import GO_Elite
#species_names = GO_Elite.remoteSpeciesData()
#species_full = string.replace(species_names[species_code],'_',' ')
#species_full = 'Mycobacterium tuberculosis'; pathway_db = {}
#pathways_all = client.service.listPathways(organism = species_full)
pathways_all = wikipathways_api_client_instance.list_pathways(organism = species_full)
pathway_db={}
for pathway in pathways_all:
#wpid = pathway[0]; wpname = pathway[2]
wpid = pathway['identifier']
wpname = pathway['name']
pathway_db[wpid] = PathwayData(wpname)
return pathway_db
示例15: client_from_wsdl
# 需要导入模块: import suds [as 别名]
# 或者: from suds import client [as 别名]
def client_from_wsdl(wsdl_content, *args, **kwargs):
"""
Constructs a non-caching suds Client based on the given WSDL content.
The wsdl_content is expected to be a raw byte string and not a unicode
string. This simple structure suits us fine here because XML content holds
its own embedded encoding identification ('utf-8' if not specified
explicitly).
Stores the content directly inside the suds library internal document
store under a hard-coded id to avoid having to load the data from a
temporary file.
Uses a locally created empty document store unless one is provided
externally using the 'documentStore' keyword argument.
Explicitly disables caching or otherwise, because we use the same
hardcoded id for our main WSDL document, suds would always reuse the first
such local document from its cache instead of fetching it from our document
store.
"""
assert wsdl_content.__class__ is suds.byte_str_class, "bad test data"
store = kwargs.get("documentStore")
if store is None:
store = suds.store.DocumentStore()
kwargs.update(documentStore=store)
test_file_id = "whatchamacallit"
store.update({test_file_id: wsdl_content})
kwargs.update(cache=None)
return suds.client.Client("suds://" + test_file_id, *args, **kwargs)