예제 #1
0
파일: wsdl.py 프로젝트: pwoolcoc/suds-py3k
 def load(self, definitions):
     """ Load the object by opening the URL """
     url = self.location
     log.debug('importing (%s)', url)
     if '://' not in url:
         url = urljoin(definitions.url, url)
     options = definitions.options
     d = Definitions(url, options)
     if d.root.match(Definitions.Tag, wsdlns):
         self.import_definitions(definitions, d)
         return
     if d.root.match(Schema.Tag, Namespace.xsdns):
         self.import_schema(definitions, d)
         return
     raise Exception('document at "{0}" is unknown'.format(url))
예제 #2
0
 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)