本文整理汇总了Python中suds.sax.element.Element.resolve方法的典型用法代码示例。如果您正苦于以下问题:Python Element.resolve方法的具体用法?Python Element.resolve怎么用?Python Element.resolve使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类suds.sax.element.Element
的用法示例。
在下文中一共展示了Element.resolve方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _ensure_service
# 需要导入模块: from suds.sax.element import Element [as 别名]
# 或者: from suds.sax.element.Element import resolve [as 别名]
def _ensure_service(self):
"""Trying to add service if no one definied explicitly. EWS workaround."""
if (self.services
or not self.bindings
or len(self.bindings) > 1
or not self.bindings.keys()[0][0].startswith('Exchange')):
return
service = Element('service')
service.set('name', 'ExchangeServices')
port = Element('port', service)
port.set('name', 'ExchangeServicePort')
port.set('binding', self.bindings.keys()[0][0])
address = Element('address', port)
address.set('location', urljoin(self.url, 'exchange.asmx'))
port.append(address)
service.append(port)
service = Factory.create(service, self)
service.resolve(self)
self.children.append(service)
self.services.append(service)
log.debug('Auto created service: %s', service)
示例2: add_extern_service
# 需要导入模块: from suds.sax.element import Element [as 别名]
# 或者: from suds.sax.element.Element import resolve [as 别名]
def add_extern_service(self, name, portname, binding, location):
"""Add a service that was not defined in the wsdl.
This is used after the Definitions object has been created.
@param name: The name of the new service.
@type url: str
@param portname: The name of the port of the new service.
@type portname: str
@param binding: The name of the wsdl binding to use for the new service.
The binding must be defined in the wsdl.
@type binding: str
@param location: The location of the new service.
@type location: str
"""
if binding not in [bind[0] for bind in self.bindings.keys()]:
log.debug('Binding "%s" not defined in %s' %
(binding, self.url))
raise Exception('Binding "%s" not defined in %s' %
(binding, self.url))
service = Element('service')
service.set('name', name)
port = Element('port', service)
port.set('name', portname)
port.set('binding', binding)
address = Element('address', port)
address.set('location', location)
port.append(address)
service.append(port)
service = Factory.create(service, self)
service.resolve(self)
self.children.append(service)
self.services.append(service)
self.add_methods(service)
log.debug('Created service: %s', service)
return service