本文整理汇总了Python中suds.reader.DocumentReader类的典型用法代码示例。如果您正苦于以下问题:Python DocumentReader类的具体用法?Python DocumentReader怎么用?Python DocumentReader使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了DocumentReader类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __download
def __download(self, url, loaded_schemata, options):
"""Download the schema."""
try:
reader = DocumentReader(options)
d = reader.open(url)
root = d.root()
root.set("url", url)
return self.schema.instance(root, url, loaded_schemata, options)
except TransportError:
msg = "import schema (%s) at (%s), failed" % (self.ns[1], url)
log.error("%s, %s", self.id, msg, exc_info=True)
raise Exception(msg)
示例2: download
def download(self, options):
""" download the schema """
try:
reader = DocumentReader(options)
d = yield reader.open(self.url)
root = d.root()
root.set('url', self.url)
schema = yield self.build_schema(root, options)
defer.returnValue(schema)
except TransportError:
msg = 'imported schema (%s) at (%s), failed' % (self.ns[1], self.url)
log.error('%s, %s', self.id, msg, exc_info=True)
raise Exception(msg)
示例3: download
def download(self, options):
""" download the schema """
url = self.location
try:
if "://" not in url:
url = urljoin(self.schema.baseurl, url)
reader = DocumentReader(options)
d = reader.open(url)
root = d.root()
root.set("url", url)
return self.schema.instance(root, url, options)
except TransportError:
msg = "imported schema (%s) at (%s), failed" % (self.ns[1], url)
log.error("%s, %s", self.id, msg, exc_info=True)
raise Exception(msg)
示例4: download
def download(self, options):
""" download the schema """
url = self.location
try:
if '://' not in url:
url = urljoin(self.schema.baseurl, url)
reader = DocumentReader(options)
d = reader.open(url)
root = d.root()
root.set('url', url)
self.__applytns(root)
return self.schema.instance(root, url, options)
except TransportError:
msg = 'include schema at (%s), failed' % url
log.error('%s, %s', self.id, msg, exc_info=True)
raise Exception(msg)
示例5: __init__
def __init__(self, url, options, already_imported=None):
"""
@param url: A URL to the WSDL.
@type url: str
@param options: An options dictionary.
@type options: L{options.Options}
@param already_imported: The list of urls of already imported wsdls
@type already_imported: list of strings
"""
log.debug('reading wsdl at: %s ...', url)
if not already_imported:
top_level = True
already_imported = [url]
else:
top_level = False
reader = DocumentReader(options)
d = reader.open(url)
root = d.root()
WObject.__init__(self, root)
self.id = objid(self)
self.options = options
self.url = url
self.tns = self.mktns(root)
self.types = []
self.schema = None
self.children = []
self.imports = []
self.messages = {}
self.port_types = {}
self.bindings = {}
self.services = []
self.add_children(self.root)
pmd = self.__metadata__.__print__
pmd.excludes.append('children')
pmd.excludes.append('wsdl')
pmd.wrappers['schema'] = repr
self.open_imports(already_imported)
if not top_level:
return
self.children.sort()
self.resolve()
self.build_schema()
self.set_wrapped()
for s in self.services:
self.add_methods(s)
log.debug("wsdl at '%s' loaded:\n%s", url, self)
示例6: build
def build(self):
log.debug('reading wsdl at: %s ...', self.url)
reader = DocumentReader(self.options)
d = yield reader.open(self.url)
root = d.root()
WObject.__init__(self, root)
self.root = root
self.tns = self.mktns(root)
self.add_children(self.root)
self.children.sort()
yield self.open_imports()
self.resolve()
yield self.build_schema()
self.set_wrapped()
for s in self.services:
self.add_methods(s)
log.debug("wsdl at '%s' loaded:\n%s", self.url, self)
示例7: __init__
def __init__(self, url, options):
"""
@param url: A URL to the WSDL.
@type url: str
@param options: An options dictionary.
@type options: L{options.Options}
"""
log.debug('reading wsdl at: %s ...', url)
reader = DocumentReader(options)
d = reader.open(url)
root = d.root()
WObject.__init__(self, root)
self.id = objid(self)
self.options = options
self.url = url
self.tns = self.mktns(root)
self.types = []
self.schema = None
self.children = []
self.imports = []
self.messages = {}
self.port_types = {}
self.bindings = {}
self.services = []
self.add_children(self.root)
self.children.sort()
pmd = self.__metadata__.__print__
pmd.excludes.append('children')
pmd.excludes.append('wsdl')
pmd.wrappers['schema'] = repr
self.open_imports()
self.resolve()
self.build_schema()
self.set_wrapped()
for s in self.services:
self.add_methods(s)
log.debug("wsdl at '%s' loaded:\n%s", url, self)
# Reset schema recursion
Schema.PROCESSED_IMPORT_DEPTH = {}
Schema.PROCESSED_IMPORTS_CACHE = {}
示例8: __init__
def __init__(self, url, options, imported_definitions=None):
"""
@param url: A URL to the WSDL.
@type url: str
@param options: An options dictionary.
@type options: L{options.Options}
"""
log.debug("reading WSDL at: %s ...", url)
reader = DocumentReader(options)
d = reader.open(url)
root = d.root()
WObject.__init__(self, root)
self.id = objid(self)
self.options = options
self.url = url
self.tns = self.mktns(root)
self.types = []
self.schema = None
self.children = []
self.imports = []
self.messages = {}
self.port_types = {}
self.bindings = {}
self.services = []
self.add_children(self.root)
self.children.sort()
pmd = self.__metadata__.__print__
pmd.excludes.append("children")
pmd.excludes.append("wsdl")
pmd.wrappers["schema"] = repr
if imported_definitions is None:
imported_definitions = {}
imported_definitions[url] = self
self.open_imports(imported_definitions)
self.resolve()
self.build_schema()
self.set_wrapped()
for s in self.services:
self.add_methods(s)
log.debug("WSDL at '%s' loaded:\n%s", url, self)