本文整理汇总了Python中mpx.lib.node.CompositeNode.get_child方法的典型用法代码示例。如果您正苦于以下问题:Python CompositeNode.get_child方法的具体用法?Python CompositeNode.get_child怎么用?Python CompositeNode.get_child使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mpx.lib.node.CompositeNode
的用法示例。
在下文中一共展示了CompositeNode.get_child方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: CNEDispatch
# 需要导入模块: from mpx.lib.node import CompositeNode [as 别名]
# 或者: from mpx.lib.node.CompositeNode import get_child [as 别名]
class CNEDispatch(CompositeNode):
def __init__(self, *args, **kw):
self.wsresponse = None
self.soapnodes = None
self.endnode = None
self.startnode = None
self.xmlnodes = None
self.parseXML = False
self.parseSOAP = True
self.serviceproxy = None
self.currenttime = None
self.password = None
self.account = None
self.namespace = None
self.wsdlURL = None
self.timeformat = '%Y-%m-%dT%H:%M:%S'
super(CNEDispatch, self).__init__(*args, **kw)
def configure(self, config):
self.wsdlURL = config.get('WSDL', self.wsdlURL)
self.account = config.get('account', self.account)
self.password = config.get('password', self.password)
self.namespace = config.get('namespace', self.namespace)
self.timeformat = config.get('timeformat', self.timeformat)
super(CNEDispatch, self).configure(config)
def configuration(self):
config = super(CNEDispatch, self).configuration()
config['WSDL'] = self.wsdlURL
config['account'] = self.account
config['password'] = self.password
config['namespace'] = self.namespace
config['timeformat'] = self.timeformat
return config
def setup(self):
dispatch = service.WSDLService(self.wsdlURL)
namespace = dispatch.wsdlDocumentProxy.wsdl.targetNamespace
if self.namespace is None:
self.namespace = namespace
dispatch.setNamespace(self.namespace)
dispatch.disableNSPrefixing()
dispatch.soapResultUnwrappingOff()
dispatch.soapObjectSimplifyingOff()
dispatch.debuggingOff()
self.serviceproxy = dispatch
def start(self):
if not self.has_child('WS Response'):
self.wsresponse = CompositeNode()
self.wsresponse.configure({'parent': self,
'name': 'WS Response'})
self.xmlnodes = xmldata.XMLDataNode()
self.xmlnodes.configure({'name': 'XML Nodes',
'parent': self.wsresponse})
self.soapnodes = soapdata.SOAPDataNode()
self.soapnodes.configure({'name': 'SOAP Nodes',
'parent': self.wsresponse})
else:
self.wsresponse = self.get_child('WS Response')
self.xmlnodes = self.wsresponse.get_child('XML Nodes')
self.soapnodes = self.wsresponse.get_child('SOAP Nodes')
if not self.has_child('Start time'):
nodepath = path.join(as_node_url(self.soapnodes),
'GetAlertsResult/disp/emralert')
self.startnode = AttributeNode()
self.startnode.configure({'name': 'Start time',
'nodeurl': nodepath,
'attribute': 'start',
'parent': self})
self.endnode = AttributeNode()
self.endnode.configure({'name': 'End time',
'nodeurl': nodepath,
'attribute': 'end',
'parent': self})
self.setup()
super(CNEDispatch, self).start()
def deprecated_start(self):
if not self.has_child('WS Response'):
self.wsresponse = xmldata.XMLDataNode()
self.wsresponse.configure(
{'name': 'WS Response', 'parent': self})
else:
self.wsresponse = self.get_child('WS Response')
dispatch = service.SOAPService(self.serviceurl, self.namespace)
dispatch.disableNSPrefixing()
dispatch.setSoapAction(self.soapaction)
dispatch.debuggingOff()
dispatch.makeMethod('GetAlerts')
dispatch.GetAlerts.appendArgument('UserName', 'string')
dispatch.GetAlerts.appendArgument('Password', 'string')
dispatch.GetAlerts.appendArgument('CurrentTime', 'string')
self.serviceproxy = dispatch
super(CNEDispatch, self).start()
def deprecated_set(self, timestamp):
if isinstance(timestamp, (int, float, long)):
timetuple = time.localtime(timestamp)
timestamp = time.strftime(self.timeformat, timetuple)
elif timestamp in (None, 'None'):
timestamp = time.strftime(self.timeformat)
self.currenttime = timestamp
self.serviceproxy.GetAlerts(self.account,
#.........这里部分代码省略.........
示例2: get_child
# 需要导入模块: from mpx.lib.node import CompositeNode [as 别名]
# 或者: from mpx.lib.node.CompositeNode import get_child [as 别名]
def get_child(self, name):
if name in set(["aliases", "interfaces", "services"]):
return self.as_remote_node("/%s" % name)
return CompositeNode.get_child(self, name)
示例3: get_child
# 需要导入模块: from mpx.lib.node import CompositeNode [as 别名]
# 或者: from mpx.lib.node.CompositeNode import get_child [as 别名]
def get_child(self, name, **options):
options['auto_discover'] = False
return CompositeNode.get_child(self, name, **options)
示例4: CNEPricing
# 需要导入模块: from mpx.lib.node import CompositeNode [as 别名]
# 或者: from mpx.lib.node.CompositeNode import get_child [as 别名]
class CNEPricing(CompositeNode):
def __init__(self, *args, **kw):
self.effectivedate = None
self.wsresponse = None
self.soapnodes = None
self.xmlnodes = None
self.parseXML = False
self.parseSOAP = True
self.serviceproxy = None
self.priceCurve = None
self.password = None
self.account = None
self.namespace = None
self.wsdlURL = None
self.dateformat = '%m/%d/%Y'
super(CNEPricing, self).__init__(*args, **kw)
def configure(self, config):
self.priceCurve = config.get('priceCurve', self.priceCurve)
self.wsdlURL = config.get('WSDL', self.wsdlURL)
self.account = config.get('account', self.account)
self.password = config.get('password', self.password)
self.namespace = config.get('namespace', self.namespace)
self.dateformat = config.get('dateformat', self.dateformat)
super(CNEPricing, self).configure(config)
def configuration(self):
config = super(CNEPricing, self).configuration()
config['WSDL'] = self.wsdlURL
config['priceCurve'] = self.priceCurve
config['account'] = self.account
config['password'] = self.password
config['namespace'] = self.namespace
config['dateformat'] = self.dateformat
return config
def setup(self):
pricing = service.WSDLService(self.wsdlURL)
namespace = pricing.wsdlDocumentProxy.wsdl.targetNamespace
if self.namespace is None:
self.namespace = namespace
pricing.setNamespace(self.namespace)
pricing.disableNSPrefixing()
pricing.soapResultUnwrappingOff()
pricing.soapObjectSimplifyingOff()
pricing.debuggingOff()
self.serviceproxy = pricing
def deprecated_setup(self):
pricing = service.WSDLService(self.wsdlURL)
pricing.debuggingOff()
pricing.disableNSPrefixing()
pricing.GetPrice.namespace = self.namespace
pricing.GetPrice.clearArguments()
pricing.GetPrice.appendArgument('strCurve', 'string')
pricing.GetPrice.appendArgument('strEffectiveDate', 'string')
pricing.GetPrice.appendArgument('CustAccount', 'string')
pricing.GetPrice.appendArgument('Pwd', 'string')
self.serviceproxy = pricing
def start(self):
if not self.has_child('WS Response'):
self.wsresponse = CompositeNode()
self.wsresponse.configure({'parent': self,
'name': 'WS Response'})
self.xmlnodes = xmldata.XMLDataNode()
self.xmlnodes.configure({'name': 'XML Nodes',
'parent': self.wsresponse})
self.soapnodes = soapdata.SOAPDataNode()
self.soapnodes.configure({'name': 'SOAP Nodes',
'parent': self.wsresponse})
else:
self.wsresponse = self.get_child('WS Response')
self.xmlnodes = self.wsresponse.get_child('XML Nodes')
self.soapnodes = self.wsresponse.get_child('SOAP Nodes')
self.setup()
super(CNEPricing, self).start()
def deprecated_set(self, timestamp):
if isinstance(timestamp, (int, float, long)):
timetuple = time.localtime(timestamp)
timestamp = time.strftime(self.dateformat, timetuple)
elif timestamp in (None, 'None'):
timestamp = time.strftime(self.dateformat)
self.effectivedate = timestamp
self.serviceproxy.GetPrice(
self.priceCurve, self.effectivedate, self.account, self.password)
self.wsresponse.set(self.serviceproxy.GetPrice.getResponse())
def set(self, timestamp = None):
if isinstance(timestamp, (int, float, long)):
timetuple = time.localtime(timestamp)
timestamp = time.strftime(self.dateformat, timetuple)
elif timestamp in (None, 'None'):
timestamp = time.strftime(self.dateformat)
self.effectivedate = timestamp
self.serviceproxy.GetPrice(
strCurve=self.priceCurve, strEffectiveDate=self.effectivedate,
CustAccount=self.account, Pwd=self.password)
response = self.serviceproxy.GetPrice.getResponse()
if self.parseXML:
self.xmlnodes.setValue(response.GetPriceResult)
if self.parseSOAP:
self.soapnodes.setValue(response)
def get(self):
#.........这里部分代码省略.........